jQuery: The Write Less, Do More JavaScript Library

$.ajax and responsed value...

View: New views
3 Messages — Rating Filter:   Alert me  

$.ajax and responsed value...

by Lord Gustavo Miguel Angel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I need transfer from resultados.php two values, to next check and run something.
Example code:
 
Code run when i clicked in button of form
 
var sData = 'name' + "gerardo" + '&password' + '123';
 
 $.ajax({
   type: "POST",
   url: '../resultados.php',
   data: sData,
   success: function(values){
        /*
         There i need check:
         if values[1] then{
            echo "all ok"
        } else{
            echo "error".
       } 
    */    
    }   
   });
 
 
-------8<---------------
resultados.php
 
<?php
    $a= $_POST["name"];
    $b=$_POST['password'];
    echo $a;
    echo $b;
?>
 
Thank´s

Re: $.ajax and responsed value...

by Josip Lazic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You could try return json encoded data from PHP, here's tutorial
http://www.prodevtips.com/2008/08/15/jquery-json-with-php-json_encode-and-json_decode/

Re: Re: $.ajax and responsed value...

by Lord Gustavo Miguel Angel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thank´s

--------------------------------------------------
From: "Josip Lazic" <jlazic4@...>
Sent: Saturday, November 07, 2009 4:02 PM
To: "jQuery (English)" <jquery-en@...>
Subject: [jQuery] Re: $.ajax and responsed value...

> You could try return json encoded data from PHP, here's tutorial
> http://www.prodevtips.com/2008/08/15/jquery-json-with-php-json_encode-and-json_decode/