July 9, 2014

How To Return Two Value In Ajax Success And Split That?

You can used any sign or symbol between two value return like in ajax call file return echo $a.'###'.$b;

When its return value at ajax success funcation you can split that value.

$.ajax({
url: 'example.php',
type :'post',
data: 'val:val',
success: function(data){
//Split using youe symbol.
var arr=data.split('###');

//For first value $a.
alert(arr[0]);

//for second value $b.
alert(arr[1]);
}
});

1 comment:

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...