473,785 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX post returning 500 Internal Server Error on Live Server

56 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. jQuery("#select-shipping").click(function(){
  2. // Open the dialog, start with the "loading page"
  3.  
  4.  
  5. $("#shipping-select").load('func/shipping_load.php').dialog({
  6.             bgiframe: true,
  7.             autoOpen: true,
  8.             position: 'center',
  9.             title: 'Select Shipping Method',
  10.             width: 400,
  11.             height: 400,
  12.             modal: true,
  13.             buttons: {
  14.                 'Apply Shipping': function() {
  15.                     var bValid = true;
  16.  
  17.                     if (bValid) {
  18.                         var fship    =    
  19.  
  20. $('input[name=shipping]:checked').val();
  21.                         var arr = 
  22.  
  23. fship.split('-');
  24.                         var shipPrice     =    
  25.  
  26. arr[1];
  27.                         var shipMeth     =    
  28.  
  29. arr[0];
  30.  
  31.                         var subOrder     =    
  32.  
  33. $("#d_total").val();
  34.                         if 
  35.  
  36. ($('#customer-discount').val() != 'false') {
  37.                             var minDis = 
  38.  
  39. subOrder * ("."+$("#customer-discount").val());
  40.                             var nTotal = 
  41.  
  42. subOrder - minDis;
  43.  
  44.                             var orderTotal 
  45.  
  46. = nTotal + parseFloat(shipPrice) + parseFloat($("#tax").val());  /* 
  47.  
  48. Order Total minus customer discount */
  49.  
  50.  
  51.  
  52. $("#order_discount_amount").val("-"+minDis.toFixed(2));
  53.                         }
  54.                         else {
  55.                             var orderTotal 
  56.  
  57. = parseFloat(subOrder) + parseFloat(shipPrice) + 
  58.  
  59. parseFloat($("#tax").val());    /* Order Total, No Discount */
  60.                         }
  61.  
  62.  
  63. $("#order_total").val(orderTotal.toFixed(2)),
  64.  
  65.  
  66. $("#shipcost").val(parseFloat(shipPrice)),
  67.  
  68.  
  69. $("#shipping_method").html(shipMeth);
  70.  
  71.  
  72.  
  73. $(this).dialog("destroy");
  74.                     }
  75.                 },
  76.                 'Close Window': function() {
  77.                     $(this).dialog("destroy");
  78.  
  79.                 }
  80.             },
  81.             close: function() {
  82.                 $(this).dialog("destroy");
  83.             }
  84.         });
  85.  
  86.         // This portion actually runs the PHP code to get the 
  87.  
  88. rate results from UPS & FedEx
  89.         $.ajax({
  90.                type: "POST",
  91.                url: "func/shipping_selection.php",
  92.             data: "shipid=" + $("#customer-ship-id").val() 
  93.  
  94. + "&cartid=" + $("#cart_id").val(),
  95.             success: function(html){
  96.                 $('#sLoader').fadeOut("fast");
  97.                 $("#sLookup").html(html);
  98.             }
  99.          });
  100.  
  101.     });
  102.  
The dialog opens a loader page (with gif) and that portion works fine.
Once the AJAX post is complete (shipping_selec tion.php), it is
supposed to update the "sLookup" div with the HTML from the
shipping_select ion.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_selec tion.php'
is actually working...rate results are returned from both UPS and
FedEx, however something is failing on the AJAX success function.
Attached Images
File Type: jpg shipping-loader.jpg (5.2 KB, 455 views)
File Type: jpg shipping-firebug-500-internal.jpg (6.3 KB, 337 views)
Jul 25 '10 #1
2 7779
dgreenhouse
250 Recognized Expert Contributor
If you're getting a 5xx error, then, something's going wrong in the script. Bracket (comment out) code segments and selectively enable various sections until you locate the error. Create a test page that just displays the returned results in a div.
Jul 25 '10 #2
perhapscwk
123 New Member
all post variable with some special character in script need to replaced by xxx

Expand|Select|Wrap|Line Numbers
  1. url = url.replace(/#/g, '%23').replace(/"/g, '%27').replace(/!/g, '%21').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/\+/g, '%2B').replace(/~/g, '%7E');
  2.  
Aug 5 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2166
by: Dave Smithz | last post by:
Hi There, I have taken over someone else's PHP code and am quite new to PHP. I made some changes and have implemented them to a live environment fine so far. However, I now want to setup a test environment. All the PHP scripts start with a few lines of: require_once "library file at specific location on server"
1
2889
by: accessyou | last post by:
I am using a windows 2000 with apache and php5 A simple url submit containing only english characters are OK: http://www.abc.com/submit.php?msg=test If the value of msg is replaced with a chinese: http://www.abc.com/submit.php?msg=中文
4
3727
by: Patrick Masson | last post by:
Hello, Our configuration : Apache 2.0.53 PHP 5.0.4 PC Windows 2000 MATLAB 6.1 We work on a consulting project in France which involves MATLAB Web server,
11
12316
by: Lieven | last post by:
Hey, I had a hard disc problem last week on my server. I replaced the disc and copied al the files to the new hard disc, everything works fine again except some php scripts that are using the mail() function. When executing these scripts I get this error: "500 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
2
9073
by: rezapasha | last post by:
Hello, we have a website in ASP , the pages connected to .mdb access database by ODBC there is a big traffic on this site, so after 9-10 hour the server show this error to visitors : HTTP Error 500.13 - Server error: Web server is too busy. Internet Information Services (IIS) BUT only .asp pages on all domains make this error, all images or aspx
23
24570
by: ticfranca | last post by:
Hi, I'm getting this error in the code below: sub Pega_recorde { $database = 'bundinha'; $host = 'localhost'; $usuario = 'myhumoradm'; $senha = 'my8xr2d2'; $dbh=DBI->connect("DBI:mysql:database=$database;host=$host","$usuario","$senha") or die "Can't open DB: $!";
0
1220
by: ticfranca | last post by:
i'm getting an error at the line : $sth->execute() or die $dbh->errstr; the error is : The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator I already check permission of cgi-bin folder and the permission of this script file. Everything is OK. Somebody help me?Please.. Internal Server Error
3
2855
by: rooznamechi.h | last post by:
Hi, I use Url rewriting on my website and my website works normally , but I don't know why Google crawlers can not read my pages . For example look at address below : http://www.labkhandha.com/Article/265/default.aspx As you can see you can see the page but here is Google's Web crawl error for this page and all rewrite pages : 500 (Internal server error) The server encountered an error and can't fulfill the request
1
1211
by: ruzlymoh | last post by:
Dear Friends Please help me to correct the following error on PHP Thanks. Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, server_admin@httpd.conf and inform them of the time the error occurred, and anything you might have done that may have caused the error.
2
3211
by: bandy | last post by:
Hi there sorry If I posted this thread under wrong head. When I am trying to run my site I am getting error as Internal Server Error, but when I refresh page , i get result properly. I don't know why this is so? Detailed error is like: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@test.mywebsite.com...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.