[Proto-Scripty] Newbie using Ajax.Request to perl script - script works but continues to return 500 status

2013-04-30 Thread jozefn
Hello to all,

This is my code and the call does complete and the back end perl script 
updates the database but I continue to get a onFailure - not sure how to 
troubleshoot this.  I have changed method to post and it works for a bit 
then begins to fail again.  At present it is failing with 500 every time 
but the actual code being called is working perfectly.

Thanks any and everyone who can give me a bit of guidance 

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 );
}


-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prototype-scriptaculous+unsubscr...@googlegroups.com.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Proto-Scripty] Newbie using Ajax.Request to perl script - script works but continues to return 500 status

2013-04-30 Thread Walter Lee Davis


On Apr 30, 2013, at 3:02 PM, joz...@sonic.net wrote:

 Hello to all,
 
 This is my code and the call does complete and the back end perl script 
 updates the database but I continue to get a onFailure - not sure how to 
 troubleshoot this.  I have changed method to post and it works for a bit then 
 begins to fail again.  At present it is failing with 500 every time but the 
 actual code being called is working perfectly.
 
 Thanks any and everyone who can give me a bit of guidance 
 
 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 );
 }
 

I'm not familiar with Catalyst, but is it setting a 200 header or similar with 
your return? You may want to emit a couple of spaces or similar, just to force 
the issue. 

Walter

 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Prototype  script.aculo.us group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to prototype-scriptaculous+unsubscr...@googlegroups.com.
 To post to this group, send email to prototype-scriptaculous@googlegroups.com.
 Visit this group at 
 http://groups.google.com/group/prototype-scriptaculous?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prototype-scriptaculous+unsubscr...@googlegroups.com.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.