Welcome Guest, Not a member yet? Register   Sign In
getting jquery to work
#1

[eluser]andes[/eluser]
Hi,

I've been trying to get jquery to work in codeigniter, but i've not been able to. I just don't know what to do. i've taken the code from this tutorial Codeigniter and Ajax Using Jquery Tutorial


it's suppose to insert data into the database without reloading the page, but it doesn't do that. I'm trying to get JQUERY working in my codeigniter application. Can anybody help me with this please?

Here's the page source for the tutorial mentioned above after i run it, if that gives some sense

Code:
<html>
<head>

<title>Simple Ajax Messaging</title>
[quote]
<sc language="javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js"> </sc>
<sc language="javascript" src="js/jquery.js"></sc>
<sc language="javascript">
$(document).ready(function() {
    $('#submit').onclick(function() {

        var msg = $('#message').val();
        
        $.post("&lt;?= site_url('message/add') ?&gt;", {message: msg}, function() {
            $('#content').load("&lt;?= site_url('message/view/ajax') ?&gt;");
            $('#message').val('');
        });
    });
});
</sc>
[/quote]
&lt;/head&gt;
&lt;body&gt;
<h1>Simple Ajax Messaging</h1>
<div id="form">

    &lt;input type="text" id="message" name="message" /&gt;
    &lt;input type="submit" id="submit" name="submit" value="submit" /&gt;
</div>
<div id="content">
<ol>
</ol>
</div>
&lt;/body&gt;
&lt;/html&gt;


basically, i need help in getting jquery to work, the right settings.
I hope someone can guide me here.

note: i made the [removed] tags to <sc> because this forum thing would remove the code with the whole script tag.




Theme © iAndrew 2016 - Forum software by © MyBB