Jump to content

not working as i expect


felito

Recommended Posts

hi

in the code above i want to send the name (with imput data by user, in case username) to a php file but

 

$name = $_POST['name']; <<<<<<<<<<<< this not retrieve nothing in the php file

 

 

js file

<script type="text/javascript">
    $(document).ready(function() {
        $("#customForm").submit(function() {
        	 $.ajax({
        	    	url: "validation.php",
        	        type: "post",
        	        dataType: "json",
        	        data: { name: $('#name').val()},
        	        success: function(data) {
        	                if (data.validateName) {
        	                    $("#msgbox1").fadeTo(200, 0.1, function() {
        	                        $(this).html('Nome inválido ou já registado na base de dados').addClass('messageboxerror1').fadeTo(900, 1);
        	                    });
        	                } 
        	               
        	                else {
        	                    $("#msgbox1").fadeTo(200, 0.1, function() {
        	                        $(this).html('Logging in.....').addClass('messageboxok1').fadeTo(900, 1, function() {
        	                            document.location = 'secure.php';
        	                        }); 
        	                    });
        	                }
        	            }});
        	            return false;
        	        });
});
</script>

 

any reason for that?

 

i test name="john" and with the name the validation is correct, so the problem is the name that is not send by js file

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/233429-not-working-as-i-expect/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.