user864980
user864980

Reputation: 21

Dojo xhrGet return empty data

i´m newbie in dojo and have a problem with xhrGet, it return empty response data.

function test1(){
            // Using dojo.xhrGet, as very little information is being sent
            dojo.xhrGet({
                // The URL of the request
                url: 'http://www.dojotoolkit.org/documentation/tutorials/1.6/ajax/demo/get-content.php',
                // The success callback with result from server             
                load: test2,                
                // The error handler
                error: function(errorMessage) {
                    // Do nothing -- keep old content there
                    alert("Error Message: " + errorMessage);
                }
            });
        }
        function test2(result, ioArgs){
            alert(result);
            dojo.byId("tContent").innerHTML += result;
        }

i debuged this code and result is empty always. can anyone say me, what i doing wrong?

thanks in advance

dimi

Upvotes: 0

Views: 551

Answers (1)

Frode
Frode

Reputation: 5710

I'm guessing this is because your site is at yourdomain.com, but you are trying to fetch data from dojotoolkit.org. This doesn't work because of the same origin policy in your browser (you cannot request a page from a different domain). Try replacing the dojotoolkit url with something from your own domain.

Upvotes: 1

Related Questions