开发者

Problem with IE [closed]

开发者 https://www.devze.com 2023-04-02 00:03 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

Does anybody have any idea why this doesn't work?

$(document).ready(function() {

    var loading;
    var results;

    form = document.getElementById('form');
    loading = document.getElementById('loading');
    results = document.getElementById('results');

    $('#Submit').click( function() {

        if($('#Search').val() == "Desired name here..")
        {alert('Please enter a valid domain name, Thank you.');return false;}

        results.style.display = 'none';
        $('#results').html('');
        $("#loading").fadeIn(2000);

        $.post('process.php?domain=' + escape($('#Search').val()),{
        }, function(response){

            results.style.display = 'block';
            $('#results').html(unescape(response)); 
            loading.style.disp开发者_如何学Pythonlay = 'none';
        });

        return false;
    });

});

HTML:

<a href="#" id="Submit"><img src="img/submit_domain.png" height="30" width="73" class="host_sb"></a>

I have jQuery installed, and it works in every other browser.

This is my problem:

Nothing loads. The #loading doesn't show which in turn doesn't display the #results


Your code is weird mix of plain JavaScript and jQuery.. not sure this cause the problem but try this optimized version:

$(document).ready(function() {
    $('#Submit').click(function() {
        var searchValue = $('#Search').val();
        if (searchValue === "Desired name here..") {
            alert('Please enter a valid domain name, Thank you.');
            return false;
        }

        var oResults = $('#results');
        oResults.html('');
        oResults.hide();
        $("#loading").fadeIn(2000);

        var now = new Date();
        $.post('process.php?domain=' + encodeURIComponent(searchValue) + '&t=' + now.getTime() , { }, function(response) {
            oResults.show();
            oResults.html(decodeURIComponent(response)); 
            $("#loading").hide();
        });

        return false;
    });
});

If no luck, try debug if you don't have any tools use plain old alert - add alert('got here'); in key lines like the beginning of the .click() function or the AJAX callback.

0

精彩评论

暂无评论...
验证码 换一张
取 消