11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

webMathematica User Guide 131fun = If[ MSPValueQ[ $$fun] && $$fun =!= "",MSPToExpression[ $$fun],Sin[x]];p = Plot[ fun, {x,0,10}];MSPShow[p]You can test this with the URL http://localhost:8080/webMathematica/Examples/AJAX/ReturnImage.jsp. You should see something like the following.Thus the page returns a fragment of HTML, not a complete document. The JavaScript functiontakes this fragment and inserts it into the document.Here is the JavaScript function in LoadImage.jsp. It is quite similar to LoadDate.jsp.function loadImage( ) {var xmlHttp;try { // Firefox, Opera 8.0+, SafarixmlHttp = new XMLHttpRequest();if (xmlHttp.overrideMimeType) {xmlHttp.overrideMimeType('text/xml');}}catch (e) {// Internet Explorertry {xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}catch (e) {try {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e) {alert("Your browser does not support AJAX!");return false;}}}xmlHttp.onreadystatechange = function() {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!