I am using simple javascript to post a form via ajax.When i use get everything works well , but as it is get request all the parameters are visible. With post this is my code but when i use it the request still uses get , any suggestions to fix it.
var url = url;
var params = params;
xmlhttp.onreadystatechange=cfunc;
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader('X_REQUESTED_WITH','XMLHttpRequest');
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);
xmlhttp.open('POST', URL, true);
is the correct form. What is telling you that it's GET?
This is an AJAX request, that shows as post for me, so you can just grab that if you want: http://jsfiddle.net/robert/AUkt4/