Tuesday, May 26, 2015

Difference between set empty and set null in jquery input value





I posted form data in Modal form using $('form#populate').serializeArray().
I manually set an input text box empty
         $("input[name='StudentID']").val(' ');
 But when I use PHP empty function, the post data from StudentID is not empty. I used Network in web developer tools in Firefox and see the post data is "+". (Although finally it will transfer to empty string)
Finally I set it as null
        $("input[name='StudentID']").val(null);
The post.data is " " in web tools and make empty function judges correctly.

No comments:

Post a Comment