javascript - Ajax working on pageload but not on button click -


i have ajax query that's working if call onpageload not if call button click. reason why?

edit: i've added events requested, please aware have debugged , getting ajax silently skipping it. call failure function if add one.

function detailsquery(crn, semester, year, questionid, clickedbutton) {     $.ajax({                 url: somebigurlwithnocallback (same domain),                 type: "get",                 datatype: "json",          success: function (data) {alert(data)}}); } 

-

   $(function() {         $(document).delegate(".button", "click", function(){detailsquery(crn,semester,year,questionid, this);});      });   window.onload=(function() {detailsquery(crn,semester,year,questionid, this);}); 

did attempt check if click event working ? try code:

   $(".button").live("click", function(){      function detailsquery(crn, semester, year, questionid, clickedbutton)    {     $.ajax({             url: somebigurlwithnocallback (same domain),             type: "get",             datatype: "json",      success: function (data) {alert(data)}           });                });                     }); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -