Skip to content Skip to sidebar Skip to footer

JavaScript Doesn't Work In Ajax Response File Aka Chat.php

I can't add any working JavaScript features in the chat.php. Basically I made a instant private messaging system with AJAX and JavaScript but the thing that sucks is that the chat.

Solution 1:

You shouldn't respond with a full blown html page to an AJAX request. Just return a snippet to insert. All the CSS and JavaScript should reside in the index.php and be called as needed. If you do need to pass JavaScript from your AJAX reply, you'll have to eval it to be executed.

Usually nowadays only JSON data is returned to AJAX calls. Depending on how complex your JavaScript actions are this might actually make it easier to handle for you.


Post a Comment for "JavaScript Doesn't Work In Ajax Response File Aka Chat.php"