user999460
user999460

Reputation: 1

prototype javascript ajax request runs back end perl script but continues to return 500

Newbie to this - This code is works - in that the call to the script does what it is supposed to but returns the condition 500 and I can not see why. I am looking for any suggestions or changes that I should be making to make this work.

Thanks to all who respond.

 function get_update_odometer(vehicle_key,odometer_value){
    var url = "[%Catalyst.uri_for('/invoice/dispatch_util/get_update_odometer')%]";
    new Ajax.Request(url, {
        method: 'get',
        parameters: {
           key: vehicle_key,
           ovalue: odometer_value
           },
        asynchronous:false,
        onSuccess: successFunc,
        onFailure:  failureFunc
       });
    var return_v  =  $('rcontainer').innerHTML;
    document.getElementById('odometer').value = return_v;
    return true;
}



function successFunc(response){
    if (200 == response.status){
      var container = $('rcontainer');
      var content = response.responseText;
      container.update(content);
    }
}

function failureFunc(response){
    alert("Call has failed " + response.status );
}

Upvotes: 0

Views: 197

Answers (1)

destroyedlolo
destroyedlolo

Reputation: 95

Error code is coming from server side, and you provided the client part.

So have a look if your server script get_update_odometer is working, is callable by your web server and etc ...

Upvotes: 0

Related Questions