Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter and AJAX

[eluser]John Murowaniecki[/eluser]
First you need to know that PHP doesn't executes directly from javascript, so your
$('#changer').html("<?php $this->load->view('tutorial-contents/page1'); ?>");
will only work if this javascript block is on some .php file BUT you need understand that if your view use <tags>, "some 'quotes' or double-quotes" or other not so special chars your script will not work.

I recomend you learn first how PHP works, then MVC, and then CodeIgniter and, before you start to build your Ajax site, build a structure without Ajax. After you finish your Ajax-less site you'll need to learn how jQuery handles events (so you'll learn about events.preventDefault() and other methods to stop propagation, etc, and this will enable you to perform server queries from your anchors - links - without reloads) can change it to operate as you wish.

If you need an exemple of Ajax querying

$('a.ajax').click(function (e) {
        url: $(this).attr('href')
    }).done(function (data) {

I hope it helps you.

Messages In This Thread
CodeIgniter and AJAX - by El Forum - 02-21-2013, 07:22 AM
CodeIgniter and AJAX - by El Forum - 02-21-2013, 08:11 AM
CodeIgniter and AJAX - by El Forum - 02-21-2013, 08:16 AM

Theme © iAndrew 2016 - Forum software by © MyBB