Jquery Serialize does not work only in IE

With this, I listed my codes, working perfectly in all browsers, but not in IE. I was looking for a stack overflow for solutions that I could not fix yet. please someone help me $ (this) .serialize () returning empty in IE

$('Form#UserTripSearch').live('submit',function() { $('#NavDetailHead12').html(HugeLoading);// for loader image alert($(this).serialize()); 

// need to return => type = 1 & sortby = desc & status = paid & name = peter

  var fullurl = $(this).attr('action')+'/'+$(this).serialize(); fullurl1= fullurl.replace(/&/g, "/"); fullurl2= fullurl1.replace(/=/g, ":"); // fullurl2 => sitename.com/type:1/sortby:desc/status:paid/name:peter $.ajax({ type: "GET", url: fullurl2, data: "ajax=true", success: function(data) { $('#NavDetailHead12').html(data); } }); return false; }); 

HTML CODE:

 <form action="sitename/search" method="get" id="UserTripSearch"> <select id="UserType" name="type"> <option value="1">User</option> <option value="2">Member</option> <option selected="selected" value="3">Non Member</option> </select> ..... <input type="text" id="UserName" placeholder="First name, Username" class="TextfiledCommon" name="name"> <div style=" float:left"> <span class="button"> <span> <input type="submit" value="Search" id="button" name="button"> </span> </span> </div> </form> 

Note. My HTML is great.

+4
source share
3 answers
 $('Form#UserTripSearch').live('submit',function() { formdata = $(this).serialize(); alert( formdata); $('#NavDetailHead12').html(HugeLoading);// for loader image .......... ............. ................ 

try the code above, it should work

You are trying to serialize after replacing dom. This should be a problem since the alleged data does not exist. Try the following :)

+1
source

There is a bug in jQuery in IE 10 (Standard / Quirks Mode) that .serialize () and .serizlizeArray () cannot serialize form data.

 <div id="showRole"> <form> <input name="roleName" type="text" /> <input name="des" type="text" /> </form> </div> 

Correction:

 var data = $("#showRole input").serialize(); 

use div id to link to form and serialize data.

IE just changes the DOM tree, and jquery cannot get elements.

+2
source

please check the answer in Fiddle Link Now this works great.

0
source

Source: https://habr.com/ru/post/1384043/


All Articles