Code ...
function ajaxRequest2(){
var url = "/cgidev2p/r_chgpwd.pgm";
var pars = 'v_current=' + escape($F('v_current')) +
'&v_new=' + escape($F('v_new')) + '&v_confirm=' + escape($F('v_confirm')) +
'&sessionid=' + escape($F('sessionid'));
//var submitObj = document.getElementById('goButton');
new Ajax.Request(url, {
method: 'get',
//contentType: 'application/json',
parameters: pars,
onSuccess: function(transport){
alert("Success");
var json = transport.responseJSON;
alert(json.success);
}
, onError: function(transport){
alert("skipped");
}
, onComplete: function(transport){
alert("Complete");
}
});
}
Alerts that I see are Success and Complete. The alert(json.success) does
not fire.
If I change the code to alert(json) the alert fires with "null".
Your PHP should emit a valid HTML file (i.e. include head and body
tags), but I don't know if that would necessarily stop it working.
The PHP correctly emits the IP. Yesterday, I caught the problem.
After the following modifications:
function makeRequest()
{
var url = 'getIP.php';
...
}
and
<form method="POST" action="" onsubmit="makeRequest(); return false;" >
...
<input type="submit" name="button" value="Submit" id="submit_button"
style="display: none;"></input>
...
the code has worked.
Anyway, thank you very much!