tags:

views:

37

answers:

1

Hello,

I want to pass both the values using ajaxForm, displaying both the values separately in test.php

-------test.php-----------------------------------------

<script language="javascript" type="text/javascript">

$('#test_form').ajaxForm({
    target:'#result',

    success:function() {
        $('#result').show();
    }
});


</script>



<form id="test_form" method="" action="test1.php">
<input type="submit" id="sub" value="sub_value">
</form>

<div id="result"></div>

-------test1.php---------------------------------------


<?
$t="test value";
$u="test value 1";

?>

Thanks Jean

A: 
-------test1.php---------------------------------------
<?
$t="test value";
$u="test value 1";

// output the result...
echo "$t $u";
?>

This will end up displaying both your values in your target div...

If you want to handle the bits of data independently then try this...

<?
$result['u'] = 'test 1';
$result['t'] = 'test 2';
echo json_encode($result);
?>

Update your javascript to handle the returned array any way you like...

rikh
i can do that, i need to display separately
Jean
If you want to get 2 different values back from 1 call, and do different things with them, then you will probably be better off returning the data in json format and then changing your javascript to handle it how you want.
rikh