javascript - Not able to get serialized Array of Kendo UI Form -


i have simple form, have form element 1 input type , button.

when click button, trying form data using

var fdata = $("#test").serializearray(); 

however reason, not able values of form.

what reason this?

jsfiddle demo

there several issues. firstly, input has no name attribute, cannot serialized. secondly, create variable called fdata, log fdata - js case sensitive. form being submit in usual method when button clicked means processing prevented after first alert. prevent can change button standard type, instead of submit button:

<form id="test" method="post">     <p>         <input id="val" name="foo" />     </p>     <button class="k-button" id="rset" type="button">submit</button> </form> 

example fiddle

or alternatively can set code run under submit event of form, , use preventdefault stop standard form submission:

$("#test").submit(function (e) {     e.preventdefault();     alert('ok');     var fdata = $(this).serializearray();     alert('rdata  ' + fdata); }); 

example fiddle


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

delphi - Indy UDP Read Contents of Adata -