php - How could I send the information in AJAX at POST? -
sorry english...
how send information that's in ajax post? (info, info_1, info_2)
now, i'm sending get
edit: try people here said me do, when call post variable in page send him info, show me eror... why?
the new code:
var xhr = new xmlhttprequest(); xhr.open("post",url,true); xhr.onreadystatechange = function() { if( this.readystate == 4 && this.status == 200) { document.getelementbyid(name).innerhtml = this.responsetext; } }; xhr.send("info="+str+"&info_1="+info_1+"&info_2="+info_2); return false; the first code:
var xhr = new xmlhttprequest(); xhr.open("get",url+"?info="+str+"&info_1="+info_1+"&info_2="+info_2,true); xhr.onreadystatechange = function() { if( this.readystate == 4 && this.status == 200) { document.getelementbyid(name).innerhtml = this.responsetext; } }; xhr.send(); return false;
change "get" "post" , put data (in same form in query string, without ? prefix) argument send() method instead of in url.
Comments
Post a Comment