0

He guys i am having this problem with loading a page through jQuery ajax. This is my first time trying to do something with jQuery and ajax calls. However a simple load doesn't show me anything also i don't know how to show all the error's it generates if it generates error's.

Any what i want is to retrieve the pages html data, would appreciate it if somebody can tell me what I'm doing wrong.

I'm using jQuery 1.10.2

This is the code I am trying to use.

$(document).ready( function(){
   loadPage();
});

function loadPage(){
var obj = {};
obj.test=true;
obj.something=true;

     $.ajax({
        type:'POST',
        url:'http://www.w3.org/',
        data:obj,
        success:onLoadComplete,
        error:onError
     });
};

function onError(){
    console.log($(this));
}

function onLoadComplete(pdata, pstatus, pxhr){
   console.log("respons: " + pdata);
   console.log("text status: " + pstatus);
   console.log("xhr: " + pxhr);
}
4

0 回答 0