Welcome Guest, Not a member yet? Register   Sign In
Codeigniter and JQuery conflict?
#1

[eluser]PODz_EN_Co.[/eluser]
I have a page written in php codeigniter with jquery. JSON seems to have a problem in locating the json function. Here's the scenario:

When you visit the site, you will be redirected to http://localhost/login. I have a test button in here to see if json is working well and here's the code:

JSON:
Code:
$('input#testBtn').click(function(){
    var item = $('input#txtUsername').val();
    $.post('login/testJSON', { 'item' : item },
      function(transport){ alert(transport.result); }, 'json');
});

CONTROLLER (under the login.php controller):
Code:
function testJSON(){
    $item = 'TESTJSON';
    $array = array('result' => $item);
    echo json_encode($array);
}

The above code works well if you are in the index of the login (http://localhost/login) however, if you have an invalid password you'll be redirected to http://localhost/login/authenticate which is the same page as the login index and if you try the test button for json, it will not work anymore.

Any ideas?


Messages In This Thread
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 12:39 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 01:08 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 01:25 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 01:42 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 01:49 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 02:11 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 02:13 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 02:17 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 02:18 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 02:24 AM
Codeigniter and JQuery conflict? - by El Forum - 01-23-2010, 03:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB