This may be a philosophical question.
Suppose you’re making an AJAX request to a page (this is using Prototype):
new Ajax.Request('target.asp',
{
method:"post",
parameters:{alldata:Object.toJSON(myinfo)},
onSuccess: function(transport){
var response = transport.responseText || "no response text";
alert("Success! \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
Now suppose on the target page, the server — using ASP — generates some JavaScript based on the myinfo object you sent it, and you are interested in the resulting JavaScript. My guess is that, since this target page is never seen by a browser (where the JS interpreter lives), the JS isn’t evaluated. And it will only be evaluated if it is returned to the calling page and evaluated there. Is that the point?
Thanks for screwing my head on straight for me.
Yes, the assumption is right. The response of that Ajax request is just a string. And that needs to be interpreted somehow that the JavaScript that’s embedded in that response is also interpreted.