Prototype.js 中的Ajax类 提交表单

来源:百度知道 编辑:UC知道 时间:2024/05/02 21:13:33
有那位高手指点一下.

如何用Prototype.js 中的Ajax类 提交表单?

var url = 'addmsg.asp';
var pars = 'book_title='+$F("book_title") + '&book_author='+$F("book_author") +"&book_address="+$F("book_address")+"&book_content=&"+$F("book_content")+"&book_classid=63";

var myAjax = new Ajax.Request(
url,
{
method: 'POST',
parameters: pars,
onCreate: showCreate,
onComplete: showResponse
});

}
function showCreate(){
("intest").innerHTML = "loading^^^^^^^^^^";
}
function showResponse(originalRequest)
{
$('book_content').value = originalRequest.responseText;
$("intest").innerHTML = originalRequest.responseText;
Element.hide("myposttable");

}
我用上面的方法提交.但是addmsg.asp页面接收不到数据.
在网上答案有的说要改xmlhttpRe

不知道你说的AJAX里的内容如何,不过你可以找到它的Request类,然后在
XMLHttp.send之前加入
if (method=="POST")
{
XMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}