Welcome Guest, Not a member yet? Register   Sign In
sending json using $this->output-set_output()
#1

[eluser]Pet[/eluser]
Hello there.I am actually running on this problem for days. I'm trying to send a json object to be handled by jquery $.get(). Here is the code for my controller.

$data = array(
// old
//'feeds' => $this->_feeds(0, $group, $friend_id, NULL, NULL, NULL, $header),
// new
'feeds' => $this->_feeds2($page = 0, $group, $friend_id, NULL, NULL, NULL, $header),
'owner_id' => $this->owner_id,
'friend_id' => $friend_id,
'group' => $group,
'type' => 'all',
'header' => $header,
);

$json = array(
'error' => FALSE,
'html' => $this->page->template($data, 'fragments/feeds'->(view template), NULL->(content_path_on template), TRUE),
);

$this->output
->set_content_type(HTTP_CONTENT_TYPE_JSON->"constant we use")
->set_output(json_encode($json));
}

This code is just a templating engine we use.
$this->page->template($data, 'fragments/feeds', NULL, TRUE)

Ok so I send an output. How can I specify the output to my jquery or how can I capture this output on my jquery?...any ideas?.. TNX


Messages In This Thread
sending json using $this->output-set_output() - by El Forum - 06-20-2012, 06:14 PM
sending json using $this->output-set_output() - by El Forum - 06-20-2012, 07:53 PM
sending json using $this->output-set_output() - by El Forum - 06-20-2012, 09:04 PM
sending json using $this->output-set_output() - by El Forum - 06-20-2012, 09:15 PM
sending json using $this->output-set_output() - by El Forum - 06-20-2012, 10:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB