Skip to main content

Bug Tracker

Side navigation

#3463 closed enhancement (invalid)

Opened October 08, 2008 05:20PM UTC

Closed October 29, 2010 05:02PM UTC

serialize functions only for forms?

Reported by: greggreenhaw Owned by:
Priority: major Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: form,ajax,serialize Cc:
Blocked by: Blocking:
Description

Why do the serialize functions only work on forms? People are moving away from forms. They are not needed with ajax. Why put useless restrictions on jquery. Here are some quick fixes or alternative for people to use. I understand it is easy to loop throught the elements array of a form.

jQuery.fn._serializeArray=function()

{

return this.map(

function()

{

var name=$(this).attr('name');

var type=$(this).attr('type');

var val=$(this).val();

var checked=$(this).attr('checked');

if(type=='checkbox' && !checked)

return;

return {name:name,value:val};

}

);

};

jQuery.fn._serialize=function()

{

return this.map(

function()

{

var name=$(this).attr('name');

var type=$(this).attr('type');

var val=$(this).val();

var checked=$(this).attr('checked');

if(type=='checkbox' && !checked)

return;

return escape(name)+'='+escape(val);

}

).get().join('&');

};

Attachments (0)
Change History (1)

Changed October 29, 2010 05:02PM UTC by rwaldron comment:1

resolution: → invalid
status: newclosed