AJAX post returning 500 Internal Server Error on Live Server

Discussion in 'PHP' started by amskape, Jul 24, 2010.

  1. #1
    I created a script where a user can select from a variety of

    shipping options for an order from within a jQuery dialog box. The

    shipping rates are delivered via UPS & FedEx. Oddly enough, the

    script works fine on my development machine, but on the live server,

    Firebug returns a "500 Internal Server Error"

    Here is what my jQuery looks like:

    jQuery("#select-shipping").click(function(){
    // Open the dialog, start with the "loading page"


    $("#shipping-select").load('func/shipping_load.php').dialog({
    bgiframe: true,
    autoOpen: true,
    position: 'center',
    title: 'Select Shipping Method',
    width: 400,
    height: 400,
    modal: true,
    buttons: {
    'Apply Shipping': function() {
    var bValid = true;

    if (bValid) {
    var fship =

    $('input[name=shipping]:checked').val();
    var arr =

    fship.split('-');
    var shipPrice =

    arr[1];
    var shipMeth =

    arr[0];

    var subOrder =

    $("#d_total").val();
    if

    ($('#customer-discount').val() != 'false') {
    var minDis =

    subOrder * ("."+$("#customer-discount").val());
    var nTotal =

    subOrder - minDis;

    var orderTotal

    = nTotal + parseFloat(shipPrice) + parseFloat($("#tax").val()); /*

    Order Total minus customer discount */



    $("#order_discount_amount").val("-"+minDis.toFixed(2));
    }
    else {
    var orderTotal

    = parseFloat(subOrder) + parseFloat(shipPrice) +

    parseFloat($("#tax").val()); /* Order Total, No Discount */
    }


    $("#order_total").val(orderTotal.toFixed(2)),


    $("#shipcost").val(parseFloat(shipPrice)),


    $("#shipping_method").html(shipMeth);



    $(this).dialog("destroy");
    }
    },
    'Close Window': function() {
    $(this).dialog("destroy");

    }
    },
    close: function() {
    $(this).dialog("destroy");
    }
    });

    // This portion actually runs the PHP code to get the

    rate results from UPS & FedEx
    $.ajax({
    type: "POST",
    url: "func/shipping_selection.php",
    data: "shipid=" + $("#customer-ship-id").val()

    + "&cartid=" + $("#cart_id").val(),
    success: function(html){
    $('#sLoader').fadeOut("fast");
    $("#sLookup").html(html);
    }
    });

    });


    The dialog opens a loader page (with gif) and that portion works fine.

    Once the AJAX post is complete (shipping_selection.php), it is

    supposed to update the "sLookup" div with the HTML from the

    shipping_selection.php page. Like I said, it works perfectly on my

    testing server, but fails on the live server. Both are running PHP

    5.2xxxx.

    Also, notice in the attached images that the 'shipping_selection.php'

    is actually working...rate results are returned from both UPS and

    FedEx, however something is failing on the AJAX success function. shipping-loader.jpg shipping-firebug-500-internal.jpg
     
    amskape, Jul 24, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    Is there any .cgi files involved, did you CHMOD them 755 ?
     
    MyVodaFone, Jul 25, 2010 IP
  3. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #3
    and it's not because of ajax it's because of func/shipping_selection.php, it has a problem
     
    hip_hop_x, Jul 25, 2010 IP
  4. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is the PHP section, and you have a PHP problem. You've posted the JavaScript code - we need the PHP code to find the problem.
    JavaScript cannot cause an internal server error (500) as it's executed on the client side.
     
    Deacalion, Jul 25, 2010 IP
  5. dontkillme

    dontkillme Well-Known Member

    Messages:
    240
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    123
    #5
    dont need to give execute rules under it.
     
    dontkillme, Jul 25, 2010 IP