开发者

jQuery serialize() not working on Ajax-loaded dialogues in IE

开发者 https://www.devze.com 2022-12-20 14:24 出处:网络
I\'m hoping someone on this site can offer some help. I have a page that uses ajax to load a form (id: \"editform\") into a jQuery-ui dialog box. The dialog box has a button attached - when someone ch

I'm hoping someone on this site can offer some help. I have a page that uses ajax to load a form (id: "editform") into a jQuery-ui dialog box. The dialog box has a button attached - when someone changes the form and clicks this button it triggers a function which serialize()s the form data and sends it via $.post to replace a div on the page with the results. This works fine in every browser I've tested on except...wait for it...IE (all versions). The problem seems to be that IE is not recognizing the call to serialize this form.

alert($("#editform").serialize());

gives me "" in IE, but the desired long querystring in other browsers. I've also tried to grab the data one piece at a time,

alert($("#name").val());

Again - IE does not recognize this field, returning "" while the other browsers output the data开发者_运维知识库 I'm looking for.

Any ideas?

Thanks


Okay - I found it. Thanks, Brandon H. for pointing me to the HTML - I hadn't closed the form () in the generated HTML, which was apparently tripping up IE. I got it up and running now.

Thanks all for your time.


Is this a typo in here, or also in your code:

alert($("#editform").serialize();

See the missing ). It should be:

alert($("#editform").serialize());
0

精彩评论

暂无评论...
验证码 换一张
取 消