Welcome Guest, Not a member yet? Register   Sign In
how to receive in an array on a ajax call
#1

[eluser]Unknown[/eluser]
how to receive in an array on a ajax call
#2

[eluser]John Madrigal[/eluser]
I'm not quite sure what your asking... If your asking how to receive a full array of data using ajax, I would usually use json to get back an array of objects to display. If you give more information I might be able to help.
#3

[eluser]Unknown[/eluser]
Hi!
hope you will be fine in your best spirit.

yes you correctly understand me i am sending parameters through javascript by making url like that

url='<?php echo base_url()?>admin/timetable/saveTimetableData/'+<?php echo $tid;?>+'/'+pNo+'/'+class+'/'+section+'/'+subject+'/'+Mon+'/'+tue+'/'+wed+'/'+thu+'/'+fri;

$.getJSON(url,function(result){

// here i want to get an array(result) to manipulate further logic
}

NOW HERE IS MY SERVER SIDE CODE

$jsonDays=array();
$data=array(
'Mon'=>1,
'Tue'=>1,
'Wed'=>0
);

echo $jsonDays.'('.json_encode($data).')';

Now problem is that i am still not able to get my array into result parameter of callback
please help how to get data array into result variable of callback
#4

[eluser]pickupman[/eluser]
This probably should be:
Code:
$jsonDays = array();
$jsonDays['Mon'] = 1;
$jsonDays['Tue'] = 1;
$jsonDays['wed'] = 0;
echo json_encode($jsonDays);
#5

[eluser]nelson.wells[/eluser]
I wrote a blog post about using jQuery ajax and json if you are interested. I think it may help with what you are trying to do.




Theme © iAndrew 2016 - Forum software by © MyBB