[eluser]boony[/eluser]
Hi All,
still having serious trouble getting ci and ajax working...
Here is the jquery post syntax that sits in the view
Code:
[removed]google.load("jquery", "1.3.2")[removed]
[removed]
$(document).ready(function()
{
$('#submit').click(function()
{
var fname = $('#fname').val();
var lname = $('#lname').val();
$.post( '<?=base_url();?>index.php/mapapp/test_ajax', {
fname: fname,
lname: lname,
}, function()
{
alert('data loaded');
});
return false;
});
});
$(document).ready(function() {
$("a").click(function() {
alert("Hello world!");
});
});
[removed]
The second click for the "a" link works and returns "Hello World" so I know that the jquery is working.
Here is the function in the controller...
Code:
function test_ajax()
{
$data = array();
if (isset($_POST['fname']))
{
$data['name'] = $_POST['fname'] ;
$this->load->view('testmap01', $data);
}
}
When the submit button is pressed the testmap01.php should run but nothing happens. So it has to be the url call. I've used both site_url and base_url but nothing works. Finally, firebug does not record any errors and the source code produces this
Code:
$.post( 'http://www.mysite.com/bws/index.php/mapapp/test_ajax', {
fname: fname,
lname: lname
I'm completely stumped and hope someone will spot the reason that this is not working. Oh, by the way the whole program works a treat as a basic php program...