Hello,
So I've been looking around in regards to my problem, and though others seem to have the same issue,I am just not finding a solution. So, I am hoping I can get a direct answer to help me out here.
End state: after executing Ajax, all jq events cease to function. Below I have a test file (named test.php), to illustrate:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Page Title</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css"/>
- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
- <style type="text/css">
- </style>
- <script type="text/javascript">
- $(document).ready(function(){
- $('#alertbutton').bind('click', function(event){
- alert("test button clicked");
- });
- $("#ajaxbutton").click(function(){
- $.ajax({type:"post", url:"test.php", data:"test=1",
- success:function(data){
- alert("AJAX complete.");
- $.mobile.changePage( "test.php", {
- transition:"flip",
- changeHash:false,
- allowSamePageTransition:true,
- reloadPage:true
- });
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <div data-role="page">
- <div data-role="content">
- <button type="button" id="alertbutton">Alert() button</button>
- <button type="button" id="ajaxbutton">AJAX button</button>
- </div>
- </div>
- </body>
- </html>
With the above code, when I click "AJAX button", the page loads itself and jq events never fire again... at least, until I F5 the page. I'm not sure what to do... this seems to be really bizarre and unproductive behavior.
If someone can help me out, I would be very grateful.
Thanks for your time,
Michael