jquery - what is the meaning of "url"+"serialized form" in $.getJSON -
good day, i've started using ajax in jquery. meaning of "url"+"serialized form" in $.getjson? thank in advance!
this not $.getjson thing jquery function query string of form field values.
for example:
<form action="javascript:alert('ok');" method=”get”> <div> <input type="text" name="field1" /> <input type="text" name="field2" /> <input type="submit" /> </div> </form>
a $('form').serialize();
return field1=<value>&field2=<value>
so in example mentioned, must have been used generate url json needs fetched. example, if have base url:
var url = 'https://example.com/some-path?q=something';
and want add parameters values in form:
$.getjson(url + $('form').serialize(), function(json) { .... });
Comments
Post a Comment