[eluser]Unknown[/eluser]
Hey guys I have a problem trying to validate a form using prototype framework, if a use ajax to send data, validation library doesn't work, but if I use a submit to send data validation works !!
This is my script to send data
Code:
new Ajax.Request('<? echo site_url();?>/inicio/Ciudad/Registrar/id_ciudad-DESC/'+campo.value,
{
method:'post',
parameters: {ciudad: campo },
onSuccess: function(transport){
var response = transport.responseText || "no response";
if(response != "no response")
{
alert(response)
}
},
onFailure: function(){ alert('Something went wrong...') }
});
I have a php script that receives the form data
Code:
function validar_datos()
{
$CI = & get_instance();
echo $ciudad = $CI->input->post('ciudad');
$CI->form_validation->set_rules('ciudad', 'ciudad', 'trim|required|min_length[30]|max_length[50]|xss_clean');
if ($CI->form_validation->run() == FALSE)
{
return FALSE;
}
else
{
return TRUE;
}
} //end function
When execute, I receive nothing as response, I tried to find the error message but nothing...
any ideas ??