JQUERY JSON load page into div not working
I am really lost here.....i have written a little function to check if the username/password of a certain user is correct using a json query. If result is ok i want to load a certain page into a div, if the result is error i want to load a different page into a div. Any help / explantion would be really much appreciated
Normally i would use $('#test').load("members.php"); to achieve this but it just isnt working (my div has an id of test - members is the page to be loaded.
- function dologin(){
- var email = $('#email').val();
- var wachtwoord = $('#wachtwoord').val();
-
- if($.trim(email) != '' && $.trim(wachtwoord) != ''){
- $.post("login2.php", {email:email,wachtwoord:wachtwoord})
- .done(function(data) {
- var response = jQuery.parseJSON(data);
- var result = response.result;
-
- if(result == 'ok'){
- $('#test').load("members.php");
- return false;
- // logged on
- }else{
- // error
- $('#test').load("loginfailed.php");
- }
-
- }, "json");
- }
- }