أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
$.post( "submit.php", "username="+username+"&password="+password, function( data ) { alert(data); } In this case data are not posted in IE browser. var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","demo_post2.asp",true); xmlhttp.setRequestHeader("Content-type","application/x-w-form-urlencoded"); xmlhttp.send("fname=Henry&lname=Ford"); This works fine with all browser except ie-10. I write code like below to support ie-10. if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.6.0"); } It is not working with mozila, safari but working with ie-10. I have not checked with ie-7. It is a conflict.
I think using Jquery will be just fine and support all browsers including IE6:
The JQuery syntax is wrong
Try this
$.post(
"submit.php",
{username:username,password:password},
function( data ) { alert(data); }
);
Also the variables that recieve these post data in submit.php must have same names as mentioned here (i.e username and password)
Look up this tutorial - http://a100websolutions.in/ajax-php-database-update/
You can learn it from following URLs:
This could be done using jQuery like this:
$("#form_id").submit(function(){
$.ajax({
data: $(this).serialize(), //serialize the form data to be sent
url:'submit.php' //the target
type:'post' // method of the form wether get / post
success: function(dataFromBackEnd){
$(body).appened(dataFromBackEnd);
}
error: function(errorMsg){
alert(errorMsg);
}
});
return false;
});
If you stick to jQuery then it handles all browser related worries. That is why jQuery was born in the first place.