javascript - call generic handler in aspx without jquery -


can call generic handler in aspx without using jquery?

yes, jquery javascript, can call writing own script. benefit of using jquery don't need worry browser compatability, have write less code, can advantage of using jquery plugins etc, cost of adding jquery.js.

example:

<script type="text/javascript">     // intialize xmlhttp object     function getxmlhttpobject() {         var a;         if (window.xmlhttprequest) {             = new xmlhttprequest();         } else {             var msxmlhttp = new array(         'msxml2.xmlhttp.6.0',         'msxml2.xmlhttp.3.0',         'msxml2.xmlhttp',         'microsoft.xmlhttp');             (var = 0; < msxmlhttp.length; i++) {                 try {                     = new activexobject(msxmlhttp[i]);                     break;                 } catch (e) {                     = null;                 }             }         }          return a;     }       function sendajaxrequest(url, postvars, callbackfunc) {         var ispost = (postvars && postvars.length > 0);          var xmlhttp = getxmlhttpobject();         if (xmlhttp == null) {             alert("your browser not support ajax!");             return;         }           if (!ispost) {             if (url.indexof('?') == -1) {                 url += '?' + uncache();             } else {                 url += '&' + uncache();             }         }         xmlhttp.onreadystatechange = function () {             if (xmlhttp.readystate == 4) { //this function execute on receive                 var callback;                 var extra_data = false;                  var data = xmlhttp.responsetext;                  callback = callbackfunc;                 callbackfunc(data, extra_data);             }         };                  //send data url through ajax         if (ispost) {             xmlhttp.open("post", url, true);             xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded");             xmlhttp.setrequestheader("content-length", postvars.length);             xmlhttp.setrequestheader("connection", "close");             xmlhttp.send(postvars);         } else {             xmlhttp.open("get", url, true);             xmlhttp.send(null);         }     }      function uncache() {         var d = new date();         var time = d.gettime();          return 'time=' + time;     }      function comp(result) {         alert(result);     }      sendajaxrequest('test.html', '', comp);   </script> 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -