Hi,

You are not clear on what the issue is, "waiting for Ajax response"

Are you saying that you don't see anything?

I'm working on a jQuery Ajax improvement and I can't wait to finish it
up and get it releases as a plugin replacement. It resolves quite a
few issues with the jQuery AJAX implementation. I mention this because
there are so many factors, including having FIREBUG in the way that
alters or hides behavior.

Here is what I do to help you track it down:

$('#apost :text').change(function(){
    var entry = $(this).val();
    var name = $(this).attr("id");
    var holder = name+"holder";
    $('#'+name).val('');
    try {
       $.ajax({
           type: "POST",
           url: "adddata.php",
           type: "html",
           data: name+"="+entry,
           processData: false,
           complete: function(obj, status) {
              $('#idLog').append("status: ",obj.status,
                                 " | ",obj.statusText, "<br>");
           },
           error: function(msg, status, err){
              alert("ERROR:\n"+
                     "\nStatus: "+status+
                     "\nError: "+err+
                     "\n\n"+msg.responseText);
           },
           success: function(msg) {
              $('#'+holder).html(msg);
           }
       });

    } catch(e) {
      alert("AJAX EXCEPTION TRAP:\n\n"+e.message?e.message:e);
    }

});

and in your body add:

<fieldset><legend>[ Log ]</legend><div id"idLog"></div></fieldset>

The try/catch is needed in there is a exception issued by the XHR
protocol or by FireBug which takes over the XHR protocol and there are
some documented issues with it.    IOW, sometimes you have to disable
FireBug but with the try/catch I found you don't have to because it
will catch whatever FireBug throws.

---
HLS



On Sep 12, 10:41 pm, atomicnuke <[EMAIL PROTECTED]> wrote:
> I have a small function outside of the onload method of the rest, so
> it'll only be loaded for a specific page.
>
> $('#apost :text').change(function(){
>         var entry = $(this).val();
>         var name = $(this).attr("id");
>         var holder = name+"holder";
>         $('#'+name).val('');
>         $.ajax({
>                 type: "POST",
>                 url: "adddata.php",
>                 type: "html",
>                 data: name+"="+entry,
>                 success: function(msg) {
>                         $('#'+holder).html(msg);
>                 }
>         });
>
> });
>
> The adddata.php file is in the same directory as the page requesting
> it. I tested the adddata page by itself and it behaves as it should.
> Also used an alert to make sure the variables are being set correctly.
> When I enter the data it clears as should, but the response is never
> inserted. I look in Firebug and the header just says Loading... Other
> Ajax requests work fine.

Reply via email to