para2x
Member
سلام بچه ها من يه فرم ارسال اطلاعات دارم كه مشكل پيدا كرده نمي دونم چرا ، به نظر كد هم درسته ولي ....
يه نگا بهش بندازين
يه نگا بهش بندازين
PHP:
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
off('sb');
loading("resultd");//loading
result = http_request.responseText;
document.getElementById('resultd').innerHTML = result;
on('sb');
} else {
alert('.یک مشکل پیش آمده است');
}
}
}
function loading(ob)
{
document.getElementById(ob).innerHTML = '<img src="ajax/progress.gif" align="absmiddle" /> در حال ارسال...';
}
function get(obj) {
user=document.getElementById('user').value;
password=document.getElementById('password').value;
password2=document.getElementById('password2').value;
name=document.getElementById('name').value;
lastname=document.getElementById('lastname').value;
pubname=document.getElementById('pubname').value;
header2=document.getElementById('header2').value;
var poststr = "user=" + user + "&password=" + password + "&password2=" + password2+ "&name=" + name + "&lastname=" + lastname + "&pubname=" + pubname + "&header=" + header2;
makePOSTRequest('process_reg.php', poststr);
}
//-------------------
function off(itm)
{
obj1=document.getElementById(itm);
obj1.disabled=true;
}
function on(itm)
{
obj2=document.getElementById(itm);
obj2.disabled=false;
}