I am trying to implement a static javascript / jQuery script for testing my ajax functions. This would be for instance somewhere in my home directory and would contain a bunch of ajax requests to my localhost:
function getSomethingAjax(){
$.get('http://127.0.0.1:8888/getSomething',{} , function(json){
getSomethingCallback(json);
}, "json");
}
My Firebug gives my an error like this:
firebug screenshot http://img443.imageshack.us/img443/4934/tinygrabscreenshot06061.png
But if I open the page manually (just type in browser: 127.0.0.1:8888/getSomething) I get the matching return. What is the difference between accessing the url? I the ajax request waiting for a specific return value?
The page making the Ajax request and page requested must be in the same domain.
The browser will block any ajax request that violates this.
Just a suggestion:
I would suggest to use a server side language to do the tests. This will allow you to make call to the application without having to keep the test scripts in the same domain.