I am loading the form in dialog box via jQuery
我通过jQuery在对话框中加载表单
The code is like
代码就像
<form class ="form1" action="" method="post" enctype="multipart/form-data" >
...
</form>
I am using jQuery form plugin to submit form like this
我正在使用jQuery表单插件来提交这样的表单
$(".form1").live('submit', function(e) {
var options = {
target: '.ajaxMessage',
beforeSubmit: showRequest,
success: showResponse,
type: 'POST'
};
alert('test');
$(this).ajaxSubmit(options);
return false;
});
Now
现在
-
If i load the form directly without AJAX and then i submit the form then form gets submiited successfuly without any problem. It works 10 out of 10 times
如果我在没有AJAX的情况下直接加载表单然后我提交表单然后表单获得成功,没有任何问题。它的工作次数为10次中的10次
-
In second case I load the form dynamically. When i click on form link then i load the form dynamically in a jquery dialog box then if i click on submit form then i can see the alert but form is not submitted. But it works sometimes but sometimes not. I would say it work 2 times out of 10.
在第二种情况下,我动态加载表单。当我点击表单链接然后我在jquery对话框中动态加载表单然后如果我点击提交表单然后我可以看到警报但表单未提交。但它有时有效,但有时不行。我会说它在10次中有2次工作。
Firebug console is also not showing any error
Firebug控制台也没有显示任何错误
Is there any way i can find whats problem
有什么方法可以找到什么问题
1 个解决方案
#1
0
Firebug will usually (I actually think not at all) won't show any errors for a ajax call, instead the error will be in the ajax request(still in firebug). Click the request and then response.
Firebug通常(我实际上根本不认为)不会显示ajax调用的任何错误,而是错误将在ajax请求中(仍然在firebug中)。单击请求,然后单击响应。
My guess is that there is a problem with the params you are sending or there is something wrong with what you a returning(i.e. you return html when ajax is expecting json, this will cause success never to be fired)
我的猜测是你发送的params存在问题,或者你返回的内容有问题(例如,当ajax期待json时你返回html,这将导致成功永远不会被触发)
Also, try to pass an error:function(jqXHR, textStatus, errorThrown){}
to the ` ajaxSubmit params and see what happens.
另外,尝试将错误:函数(jqXHR,textStatus,errorThrown){}传递给`ajaxSubmit参数,看看会发生什么。
#1
0
Firebug will usually (I actually think not at all) won't show any errors for a ajax call, instead the error will be in the ajax request(still in firebug). Click the request and then response.
Firebug通常(我实际上根本不认为)不会显示ajax调用的任何错误,而是错误将在ajax请求中(仍然在firebug中)。单击请求,然后单击响应。
My guess is that there is a problem with the params you are sending or there is something wrong with what you a returning(i.e. you return html when ajax is expecting json, this will cause success never to be fired)
我的猜测是你发送的params存在问题,或者你返回的内容有问题(例如,当ajax期待json时你返回html,这将导致成功永远不会被触发)
Also, try to pass an error:function(jqXHR, textStatus, errorThrown){}
to the ` ajaxSubmit params and see what happens.
另外,尝试将错误:函数(jqXHR,textStatus,errorThrown){}传递给`ajaxSubmit参数,看看会发生什么。