Including a file in json_encode()
<p>Thsi does not seem to work:</p>

<pre><code>$msg="Your changes have been saved successfully";

$view=include('application/view/admin/cms/_slides-current.php');

$return_array=array('success'=&gt;true, 'msg'=&gt;$msg, 'view'=&gt;$view);

echo json_encode($return_array);
</code></pre>

<p>The array needs to be passed back to a jQuery ajax success callback. Anybody know how it should be done?</p>

<p>The include file is simply a HTML template. This HTML template will be inserted on to the page.</p>

<p>Is there any way other than using json_encode() to do what I am trying to do?</p>

<pre><code>success: function(result){
    alert(result.msg);

    if(result.success == true)
    {
        $('#slides').html(result.view);
    }
}
</code></pre>
