php - Ajax Method without XMLHttpRequest() Object -
i have 1 query ajax methodology. used work ajax use 4 simple lines written below:
$.ajax({ type: "post", url: "/application/group/addmembers", data: {memberids: selectedmembers, groupid:<?php echo $this->groupid; ?>}, success: (function(msg) { // alert(msg); var ans = json.parse(msg); alert(ans['message']); // msg array returned php script in json }) });
now, when study more on different sites or tutorials. ajax creating xmlhtmlrequest(), used exchange information server. , more things open, send functions.
but don't create xmlhtmlrequest object , ajax still works fine. want know difference. lose when don't communicate server using xmlhtmlrequest object. did search on it. still need answer.
the difference between 4 simple line , xmlhttprequest() language xmlhttprequest() pure javascript while code above jquery. infact ignore both , use jquery.get() & jquery.load() higher-level alternatives , easier use. if less common options required, though, $.ajax() can used more flexibly.
Comments
Post a Comment