Question : AJAX post returning 500 Internal Server Error on Live Server

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:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
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.
Attachments:
 
Shipping Loader Dialog
Shipping Loader Dialog
 
 
Firebug Error with Returned Results
Firebug Error with Returned Results
 

Answer : AJAX post returning 500 Internal Server Error on Live Server

Is this what you are looking for?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function died($error) {
                // your error code can go here?
                    ??I WANT TO PUT HTML PAGE HERE WITH ERRORS
                ?>
                <b>all the html you want</b>
                <?
                echo "We are very sorry, but there were error(s) found with the form your submitted. ";
                echo "These errors appear below.<br /><br />";
                echo $error."<br /><br />";
                echo "Please go back and fix these errors.<br /><br />";
                die();
        }
        
        // validation expected data exists
        if(!isset($_POST['first_name']) ||
                !isset($_POST['last_name']) ||
                !isset($_POST['email']) ||
                !isset($_POST['telephone']) ||
                !isset($_POST['comments'])) {
                died('We are sorry, but there appears to be a problem with the form your submitted.');          
        }
Random Solutions  
 
programming4us programming4us