Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 307
Zeth Avatar asked Feb 19 '10 23:02

Zeth


2 Answers

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.

like image 126
Zeth Avatar answered Nov 18 '22 20:11

Zeth


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

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

See the missing ). It should be:

alert($("#editform").serialize());
like image 38
Donny Kurnia Avatar answered Nov 18 '22 19:11

Donny Kurnia