|
|
|
ช่วยดูให้ทีคับ error ajax ทำตามหนังสือทำไมยัง error |
|
|
|
|
|
|
|
ขอดูโค้ด ไฟล์ ajax_framework.js ว่าฟังก์ชัน getFormData เขียนไว้อย่างไร
|
|
|
|
|
Date :
2010-12-19 12:30:42 |
By :
DS_Ohm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไฟล์นี้หรือเปล่าคับ
Code (JavaScript)
// JavaScript Documentfunction ajaxLoad(method, URL, data, displayId) {
var ajax = null;
if(window.ActiveXObject) {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest) {
ajax = new XMLHttpRequest();
}
else {
alert("Your browser doesn't support Ajax");
return;
}
method = method.toLowerCase();
URL += "?dummy=" + (new Date()).getTime();
if(method=="get") {
URL += "&" + data;
data = null;
}
ajax.open(method, URL);
if(method=="post") {
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
ajax.onreadystatechange = function() {
if(ajax.readyState==4 && ajax.status==200) {
var ctype = ajax.getResponseHeader("Content-Type").toLowerCase();
ajaxCallback(ctype, displayId, ajax.responseText);
delete ajax;
ajax = null;
}
}
ajax.send(data);
}
function ajaxCallback(contentType, displayId, responseText) {
if(contentType.match("text/javascript")) {
eval(responseText);
}
else {
var el = document.getElementById(displayId);
el.innerHTML = responseText;
}
}
function getFormData(form_name_or_id) {
var frm = document.forms[form_name_or_id];
if(frm==null) {
alert("form not found!");
return;
}
var data = "";
var num_el = frm.elements.length;
for(i=0; i<NUM_EL; ?="; data += encodeURI(select.options[j].value); } } continue; } if(data!=" +="&" data } ; { ?) ) if(data!="" if(el.options[j].selected) j++) j<el.length; for(j="0;" if(t='="text"||t=="password"||t=="hidden"||t=="textarea")' else value="" continue; if(el.checked) var t="frm.elements[i].type;" param_name="" if(el.id!="" if(el.name!="" el.id='="")' && if(el.name='=""' el="frm.elements[i];" i++)>
<SCRIPT src="/inc/gg_read2.js"></SCRIPT>
|
|
|
|
|
Date :
2010-12-19 13:37:10 |
By :
boo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บันทัดแรกมันคอมเม้นชื่อฟังก์ชั่นไว้อ่าครับ ผิดตั้งแต่บันทัดแรกแล้ว
|
|
|
|
|
Date :
2010-12-21 02:09:12 |
By :
chineji |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|