Last active
December 29, 2015 23:59
-
-
Save Xordal/7746052 to your computer and use it in GitHub Desktop.
Return serialized form without null-value fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Удаление null-полей из модели | |
var cleanedForm = function(form) { | |
"use strict"; | |
var thisArray = $("#" + form).serializeArray(); | |
$.each(thisArray, function(index, item) { | |
if (item.value.toString().toLowerCase() == "null") { | |
delete thisArray[index]; | |
} | |
}); | |
return thisArray; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment