Welcome Guest, Not a member yet? Register   Sign In
Unable to get jquery ajax working
#1

[eluser]ssachan[/eluser]
Hello Developers,
I am struggling to get jquery’s $post method to get working, here is my code snippet

my jquery code in my view looks like :

$(document).ready(function(){
$(”.button”).click(function(){
$.post(’/welcome/get_messages/’, {ajax:‘true’},
function(data){
alert(data);
}, ‘json’);
});
});

the controller welcome.php has the get_messages function that has a simple echo

function get_messages()
{
echo “Hello”;

}


however my alert(data) gives me a null.
I am guessing that the URL in post command is incorrect, but then I have tried all the
following as well
‘<?=base_url()?>application/controllers/welcome/get_messages’
‘<?=base_url()?>/index.php/application/controllers/welcome/get_messages’
but none seem to work.

Please suggest me something that can get my code working.

Thanking in anticipation

Shikhar


Messages In This Thread
Unable to get jquery ajax working - by El Forum - 04-22-2010, 03:40 PM
Unable to get jquery ajax working - by El Forum - 04-22-2010, 04:30 PM
Unable to get jquery ajax working - by El Forum - 04-22-2010, 05:08 PM
Unable to get jquery ajax working - by El Forum - 04-22-2010, 05:20 PM
Unable to get jquery ajax working - by El Forum - 04-22-2010, 05:29 PM
Unable to get jquery ajax working - by El Forum - 04-23-2010, 09:11 AM
Unable to get jquery ajax working - by El Forum - 04-23-2010, 10:34 AM
Unable to get jquery ajax working - by El Forum - 04-23-2010, 12:56 PM
Unable to get jquery ajax working - by El Forum - 04-23-2010, 01:15 PM
Unable to get jquery ajax working - by El Forum - 04-23-2010, 01:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB