Where is the problem in this prototype [ajax.Request] code?
function sendM() {
new Ajax.Request("sendm.html",
{
method: 'post',
postBody: 'text='+ $F('text') +'&sub='+ $F('subject') +'&sname='+ $F('name') +'&sfmail='+ $F('email') +'to='+ $F('to'),
onLoading:showLoad,
onComplete: showResponse
});
}
function showLoad(){
$('dresult').innerHTML= "מבצע את开发者_Python百科 הפעולה <br /><br />";
}
function showResponse(req){
$('dresult').innerHTML= req.responseText;
}
The hTML Form code :
<form id="sfunc" name="sfunc" onsubmit="return false;">
שם
דוא"ל
יעד
1
2
3
נושא
הודעה
You attempted to use showLoad and showResponse before they were initialized. Move your function definitions for showLoad and showResponse above your Ajax request.
For future reference, note that any error occuring inside your Ajax handlers do not print out errors in your browser error console. You'll have to create breakpoints in the handlers to fix the problem. Use a debugger like Firefox's Firebug plugin.
精彩评论