javascript - jquery ajax call "metho" instead of "method"? -
i have script.js uses jquery's ajax function query string php file, works expected find odd must use "metho" sintax instead of "method", @ this,
this works
script.js
$.ajax({ url: 'php/printers.php', metho: 'post', data: { data: c, orderby: d, }, success: function(output) { $('.results').html(output); var tbody = document.getelementsbyclassname('results'); var rows = tbody[0].getelementsbytagname('tr'); ajax.applyclass(rows); } });
this doesn't
$.ajax({ url: 'php/printers.php', method: 'post', data: { data: c, orderby: d, }, success: function(output) { $('.results').html(output); var tbody = document.getelementsbyclassname('results'); var rows = tbody[0].getelementsbytagname('tr'); ajax.applyclass(rows); } });
i'm preplexed must use "metho" instead "method" :o don't know how happened, though typo??
the difference default method of ajax
"get"
. since there's no metho
option ajax
, that's ignored , default being used. when specify method: "post"
, you're overriding default, using post instead of get.
so can infer script being called works correctly when used, , not when post used (probably because of looks data receives).
Comments
Post a Comment