Sim Posted June 28, 2020 Share Posted June 28, 2020 So now that I got all pages with links to load in my content area, my next hurdle is the forms. I can't get the code to LMK when a form is being submitted . I can't bind it upon loading page since the forms will be loaded at a later time. So I tried to bind any form that is inside php__container. There's definitely a bunch of people here that seems like they know more about this then me. var jq = $.noConflict(); jq(document).ready(function() { jq("#php__container > form").submit(function(){ alert("form"); e.preventDefault(); }); jq('a').on('click', function(e) { var url = jq(this).attr('href'); if(url.includes("?")) { e.preventDefault(); jq("#php__container").load(url); } }); jq('#php__container').click(function(e){ if (jq(e.target).is('a')) { e.preventDefault(); var url = e.target.href; jq("#php__container").load(url); //alert(url); } }); // update_stats(); }); Quote Link to comment Share on other sites More sharing options...
Dave Posted June 28, 2020 Share Posted June 28, 2020 Every time you modify the contents of the content using AJAX just run your finding that binds to all forms, as any form that was there previously won't exist anymore. Quote Link to comment Share on other sites More sharing options...
Sim Posted June 28, 2020 Author Share Posted June 28, 2020 Edit: deleted old code in this post. This works. jq("#php__container").on('submit', 'form', function(e){ e.preventDefault(); var url = jq(this).attr("action"); alert(url); return false; }); Problem being that all GL forms action URLs are ="" so, I can't submit the forms to the right URL as of now. I can do a session thing. Anyone know away to make the back button work on jQuery pages? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.