jquery - How to send extra data with AJAX form submit -


i have html form. contains file input.

after browsing file, want send file server.

i have written code submit form. & getting file & data on server.

i want send data while submitting form, used on server. how can done? how send data form client side & how read on server?

$("#myform").ajaxform({      success : function(data) {          var localdata = json.parse(data);      },      datatype : "text"  }).submit();    <form id="myform" method="post" action="/myformsubmit" enctype="multipart/form-data">      <div class="custom-upload fl">          <input type="file" id="selectfile" name="selectfile">                          <div class="fileupload"></div>      </div>      <div class="fl" style="padding: 1px 0 0 5px;">          <input name="input4" type="button" class="button submit upload" value="upload" tabindex="100" />      </div>  </form> 

i assume using jquery form plugin, should add data property options of ajaxform() call. (data property is, according plugin's documentation, an object containing data should submitted along form).

$("#myform").ajaxform({      success : function(data) {          var localdata = json.parse(data);      },      datatype : "text",     data: {          yourparam1: "yourvalue1",          yourparam2: ...     } }).submit(); 

as processing data on server, good, if started reading tutorial, e.g. http://docs.oracle.com/javaee/6/tutorial/doc/bnafd.html (or watch a video tutorial). hint: data (form values + additional data) request parameters.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -