开发者

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, wha开发者_开发技巧t i doing wrong?

thanks in advance

dimi


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜