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

后端 未结 7 1831
别那么骄傲
别那么骄傲 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 04:07

    As a matter of habit you should deal with your request variables early in your script, and sanitize them to death -- then assign the cleaned results to new variables and be strict in only using them throughout the rest of the script. As such you should have alarm bells ringing whenever you have a request variable in or near an sql query.

    For example at the very least you should be stripping any html tags out of anything that will get printed back to the page.

    That is in addition to escaping the quotes as part of the sql string when inserting into the database.

    I'm all for coding things up quickly -- sure, neaten up your code later... but get security of request vars right before doing anything. You can't tack on security later.

    Anyway sorry for harping on.... as for your actual problem, have you tried what Gaby suggested: change your html to:

    
    

    And then update your JS function to:

    function pmNew(mexid) {
        $.ajax({
            type: 'POST',
            cache: false,
            url: './asynch/asynchf.php',
            data: 'mexid=' + escape(mexid) + '&id=pmnew',
            success: function(msg) {
                $('#pmuser').html('PANEL (' + msg + ')');
            }
        });
        return false;
    }
    

    Also, with IE -- check the obvious. Clear the browser cache/history

提交回复
热议问题