Actually, you don't need var html at all so:

$.ajax({
      url: "ATBAjaxHandler.do",
      data:
"service-name=nb_places_available&date="+date+"&flight="+flight,
      success: function(html) {
             alert("HTML = "+html);
             $('#nbPlacesAller').html(html);
      } });

Will work fine.

- jake

On 5/30/07, Jake McGraw <[EMAIL PROTECTED]> wrote:

You need to set the callback, not just access the XHR object, because it
may not (definitely won't) be ready immediately after you call $.ajax, try:

var html = $.ajax({
       url: "ATBAjaxHandler.do",
       data:
"service-name=nb_places_available&date="+date+"&flight="+flight,
       success: function(html) {
             alert("HTML = "+html);
             $('#nbPlacesAller').html(html);
       }
});

I also jQuerized your success function.

- jake

On 5/30/07, debussy007 < [EMAIL PROTECTED]> wrote:
>
>
>
> Hi,
>
> I am calling an Ajax request to the server (J2ee, Struts Action) to get
> a
> number :
>
>
> *************************************************************************
> alert(date);
> alert(flight);
>
> var html = $.ajax({
>         url: "ATBAjaxHandler.do",
>         data:
> "service-name=nb_places_available&date="+date+"&flight="+flight
> }).responseText;
>
> alert("HTML = "+html);
> document.getElementById('nbPlacesAller').innerHtml = html;
>
> *************************************************************************
>
> in IE the last alert is never shown, in Mozilla it shows "HTML = "
> followed
> by an empty string
>
>
> I am returning the number like this in the server :
>
> response.getWriter().println(""+nbActiveBooks);
>
>
>
> Is there any way to know what is the actual error ?
> I am really clueless on what to do.
> Do you have any debugging tips ?
>
> Thank you very much.
> --
> View this message in context:
> http://www.nabble.com/ajax-request-error-tf3840045s15494.html#a10872627
> Sent from the JQuery mailing list archive at Nabble.com.
>
>

Reply via email to