When you enter a character (?) As parameter returns me empty. I put
this example:
In a text box with id = "name" entry = "Hi" and through this function:
function sendRequest() {
new Ajax.Request("contact.php",
{
method: 'post',
parameters: 'name='+$F('name'),
onCreate : function startLoading() {
$('respuesta').innerHTML= '<img src="images/sending.gif"
width="16" height="16" align="absmiddle">';
Form.Element.disable("Envia");
},
onComplete: function showResponse(req){
$('respuesta').innerHTML= req.responseText;
Form.Element.enable("Envia");
if(req.responseText == "success") {
$('mensaje_contacto').innerHTML= 'success';
}
}
});
}
I return "Hi" satisfactorily. But if I enter "Hi?" I returned empty.
It seems that if I enter (?) Occurs an error in the parameter section.
How can I solve this?. I hope your help. Thank you very much.
You're supplying the parameters as a string, which means *you're*
taking responsibility for URL-encoding them correctly[1] -- but you're
not. I suggest letting Prototype handle the encoding, by supplying
your parameters as an object:
parameters: {name: $F('name')},
[1] http://prototypejs.org/api/ajax/options
HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com