Ajax Call

hi i am sending ajax request like below


and added a div like below

 
{foreach $messages as $message}
Message seen 3.16pm
{$message['message']}
{/foreach}

here is the controller code

if ($mode == 'threads')
{
    if (isset($_REQUEST['thread_id']) && isset($_REQUEST['is_ajax'])){
        $thread_id = $_REQUEST['thread_id'];
        $params = [
            'user_id'   => $auth['user_id'],
            'thread_id' => (int) $thread_id,
          ];
        $messages = fn_vendor_communication_get_thread_messages($params);
        // return $messages;
        Tygh::$app['ajax']->assign('messages', $messages);
        exit;
    }

}

The issue is that i am getting the response nothing is being displayed in the results_ids div.

and also results_id variable is not being sent with the ajax request url it is like

			<span>GET</span>
		
			<div><span><span>http://</span><span>pushi.local</span><span>/index.php</span><span>?</span><span><span>dispatch</span><span>=</span><span>vendor_communication.threads</span><span>&</span></span><span><span>thread_id</span><span>=</span><span>34</span><span>&</span></span><span><span>is_ajax</span><span>=</span><span>1</span></span></span></div>

update:

i changed the ajax request according to documentation added

data-ca-target-id="chat_area_div"

instead of adding result ids in the url but still its not working

Since you use the exit function, you should show some content before exit. E.g.

Tygh::$app['view']->display('path/to/template.tpl');

@mohsin1631 Did you end up ever figuring this out? I have been struggling with trying to use Ajax/cm-submit with a checkbox to reload a div on the same page, without reloading the entire page. The documentation for CS-Cart is generally okay but the examples just aren't there and the few examples of CS-Cart handling things in a similar way in the original code base are irrelevant.

Cheers