Jump to content
MakeWebGames

jQuery round #3 Forms


Sim

Recommended Posts

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();
  
});

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...