Steven
Steven

Reputation: 13975

Jquery not working?

It ended up being the $(document).ready was missing. Now that I added that the returned html does not seem to want to display. Is there something wrong with the below code?

    success: function(data){
        jQuery('#response').empty();
        var response = jQuery(data).find('#response').html();
        jQuery('#response').hide().html(response).fadeIn();
        jQuery('#loading').remove();
    }

Upvotes: 0

Views: 95

Answers (3)

Steven
Steven

Reputation: 13975

I fixed it, it was the var response = jQuery(data).find('#response').html(); I was looking for the wrong div.

Upvotes: 0

attack
attack

Reputation: 1523

It may be because "#userbar" isn't available in the DOM yet. Is your script nested within a document.ready event? Like this:

jQuery(document).ready(function() {
    var username...
});

Or, the shortcut:

jQuery(function() {
    var username...
});

Or the super shortcut:

$(function() {
    var username...
});

Upvotes: 1

epascarello
epascarello

Reputation: 207501

Is uvhclan.com the same domain of the call? If it is not, you can not make the call because of the Same Origin Policy

If it is the same domain, an error would cause the page to submit and not cancel the submit. Look at the JavaScript console and see if there is an error.

Upvotes: 0

Related Questions