I am teaching myself the basics of ajax. I have a good basic knowledge of JavaScript. I have a site that I use JavaScript like it was going out of style but would benefit greatly with the use of ajax. So I am playing around with ajax. In my exploration of ajax, I am building a very simple page which calls the body of a very simple aspx page. It works great, until I want to fire the ajax with a button click. the button will fire the event, but after it runs the jquery library - //ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js - , it skips over the ajax.
The JavaScript snippet in external file
$(document).ready(function () { var myButton = document.getElementById('<%= btnsubmit.ClientID %>'); myButton.onclick = function () { var script = document.createElement("script"); $.ajax({ url: "testmenow.aspx", data: null, success: function (data) { $("#parttable").html(data); } }); return false; } });
The link to JavaScript file is on the master page. I have not had a problem with that until now.
The code on default.aspx
<div id="parttable"> </div> <asp:Button ID="btnsubmit" runat="server" Text="click me" name="btnsubmit" />
Any tips would be greatly appreciated.