javascript - Does a HTML form need an Action/Method in order to be submit? -
could submitted servlet without action or method? i.e.(could use jquery alone send this?, or other method?)
<form id="form2"> <input type="text" value="12" name="id"/> <input type="text" value="namethatcomesfirst" name="firstname"/> <input type="text" value="namethatcomeslast" name="lastname"/> <input type=submit id="submit" value="submit"/> </form>
no, doesn't need there, default submit loaded script, using get.
if want submit ajax, can define when calling instead of through action/method attribute if want using the jquery form plugin.
$('#form2').ajaxform( { url: 'comment.php', type: 'put', success: function() { alert('thanks comment!'); } }); // suggested way put action , method on form , `$.ajaxform` // find it. $('#form2').ajaxform({ success: function() { alert('thanks comment!'); }});
you can send form querying dom , sending ajax request
Comments
Post a Comment