jQuery/Ajax call - It Doesn't work on IE7

后端 未结 7 1832
别那么骄傲
别那么骄傲 2021-01-20 03:35

i make a Jquery function that (for the moment) call a function dinamically and print it with an alert. with firefox, chrome : it works! when i try on IE7 (the first time), i

7条回答
  •  醉话见心
    2021-01-20 03:51

    ok, I'm not exactly sure what the issue is here but I think you could probably fix this by simply letting jquery handle the click instead of the inline attribute on the tag.

    first change your link like this to get rid of the inline event

    
    

    then in your javascript in the head of your page add a document.ready event function like this if you don't already have one:

    $(function(){
    
    });
    

    then bind a click event to your link inside the ready function using the class and have it pull the mexid from the href attribute, then call your pmNew function like so:

    $(".lblueb").click(function(e){
    
      e.preventDefault();
    
      //your query string will be in parts[1];
      parts = $(this).attr("href").split("?");
      //your mexid will be in mexid[1]
      mexid = $parts[1].split("="); 
    
      //call your function with mexid[1] as the parameter
      pmNew(mexid[1]);
    
    });
    

    Your final code should look like this:

    
    

提交回复
热议问题