Welcome Guest, Not a member yet? Register   Sign In
AJAX, JQUERY and document. ready
#1

[eluser]neoblasted[/eluser]
Hi,

IM new to ajax in CI and jQuery. Im using a CI HMVC setup.
IM trying to convert a php AJAX IM messenger to CI.


Im loading the chat module in my template in the footer using
Code:
<?php echo modules::run('chat/chat_view');?>

here's the content of the view.
Code:
<div id="main_container">

<a href="[removed]void(0)">Chat with name_lastname</a>


</div> [removed][removed]'
The javascript to cal the chat.js is removed, but it is placed here...

Here a part of the JQUERY Function to call the php AJAX function
Code:
function startChatSession(){  
$.ajax({
url: "http://servername/dir/index.php/en/chat/startchatsession",
dataType: "json",
success: function(data)
{
           do stuff
        }

}


When calling chat.js, the Document.ready in the chat.js is fired, An it call a AJAX function in the chat controller to retrieve sessions and start the timer (To refresh the chat messages). But when it call the AJAX function /chat/startchatsession the Ajax function only return the ECHOS and it just die... Can you give me a clue what im doing wrong ?

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB