Forum Moderators: open

Message Too Old, No Replies

jQuery .html() function not displaying ajax success return value in In

         

JRNeher

6:57 pm on Nov 11, 2010 (gmt 0)

10+ Year Member



I have a jQuery function that I am calling on a click event. The code snippet is below:

$.ajax({
url: '/delivery_windows/' + current_month + '/' + selected_day,
success: function(data) {
$('#time-selection').html(data);
}
});


Above this snippet in the actual file, current_month and selected_day are being set. I have added an alert(data) function within the success function and the proper html shows in the alert box, but the time-selection element displays completely empty on the web page.

I have tested in Firefox, Chrome, Safari, and Opera. All of these work as expected. IE 7 and IE 8 are the only ones that return an empty time-selection element.

I have read on other posts to try calling .empty() on time-selection and then call .append() instead of using .html(), but I get the same results.

Does anyone have an idea of what I am doing wrong with this?

Any help would be greatly appreciated!

I am building this in Drupal in case that makes a difference, with jQuery 1.3.2

Thanks in advance!

Fotiman

2:26 pm on Nov 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you perhaps have more than one element on the page with id 'time-selection'?

Frank_Rizzo

2:38 pm on Nov 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try testing the on click event calling

$('#time-selection').html(data);

rather than the ajax call. That will eliminate the ajax call as the problem.