Why not use getJSON?

>From the docs http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback

As of jQuery 1.2, you can load JSON data located on another domain if
you specify a JSONP callback, which can be done like so: "myurl?
callback=?". jQuery automatically replaces the ? with the correct
method name to call, calling your specified callback.

This is a piece of working code:

$.getJSON("http://ws.geonames.org/searchJSON?q="+m.editSearch
+"&featureClass=P&featureClass=A&callback=?",
        function(data){ // the callback-function, data came from geonames
                if (data.totalResultsCount > 0){

....

Regards, Frank

On 24 Dez., 22:31, Ryura <[EMAIL PROTECTED]> wrote:
> Basically, I'm trying to pull data from a database on a different
> server.
>
> On the site without the database (we'll sayhttp://thisdomain.com/index.html),
> I have
> var gomon = new Array();
> gomon[0] = "Test";
> gomon[1] = "Testx";
> gomon[2] = "Test3";
>
> $.ajax({
>   type: "GET",
>   url: "http://somedomain.net/jsonp/selection.php";,
>   dataType: "jsonp",
>   data: "foo="+gomon,
>   success: function(gata){
>           alert(gata.go[3]].repping)
>         }
>
> });
>
> selection.php basically is echoing this:
> ({
> "go": [
> {"zepping":"grrrrrrr","zamount":"1","zepped":"Ryura","tzme":"2"},
> {"zepping":"grrrrarrr","zamount":"1","zepped":"Ryura","tzme":"2"},
> {"zepping":"grrrrsrrr","zamount":"1","zepped":"Ryura","tzme":"2"},
> {"zepping":"grrrdrrrr","zamount":"1","zepped":"Ryura","tzme":"2"}
> ]
>
> })
>
> Now, when viewing thisdomain.com/index.html, Firebug gives me this
> error:
> [Exception... "'Permission denied to call method XMLHttpRequest.open'
> when calling method: [nsIDOMEventListener::handleEvent]" nsresult:
> "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>"
> data: no]
>
> And nothing executes. What did I do wrong?
>
> Thanks,
> Ryura

Reply via email to