I have been trying to retrieve JSON data from my php file.Its giving me a hard time.This is my code
Code in my VIEW:
var productDetails = {\'id\':ISB
General method I use for my Ajax Calls in CI :
JS :
post_array =
{
"myvar" : "value1",
"myvar2": "value2"
}
$.post(baseUrl + "/AjaxController/my_function", post_array,
function(data)
{
var res = jQuery.parseJSON(data);
alert(res.property);
}
Controller :
public function my_function()
{
$myvar = $this->input->post('myvar');
$myvar2 = $this->input->post('myvar2');
//Stuff
echo json_encode($myobject);
}