CodeIgniter Forums

Full Version: JSON won't print individual value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I am running a jquery ajax function to get JSON data, the data is returned properly, but when I go to display it, the variable shows up undefined.

public function ajax_add_new_task()
  $b ='';
  $b .= '<table>';
  $b .= '<tr><td>Task Title:</td><td>&lt;input type="text" name="title" id="title"&gt;&lt;/td></tr>';
  $b .= '</table>';
  $result['success'] = TRUE;
  $result['message'] = $b;
  echo json_encode( $result);

function show_add_task()
             type: "POST",
             url: "tasks/ajax_add_new_task",
             data: {
             success: function(msg) {