Welcome Guest, Not a member yet? Register   Sign In
Return values from CI controllers to Javacript (jQuery)
#16

[eluser]MaartenDeGroote[/eluser]
I figured this one out. Well, not exactly but I found a solution.
All i did was changing the following code:

Code:
$(document).ready(function(){
    $("form").submit(function(){
        var str = $(this).serialize();
        $.ajax({
            type : "POST",
            url : "ajax/form",
            data : str,
            success : function(msg){
                alert(msg.message)
            }
        }, "json");
        return false;
    });
});

to

Code:
$(document).ready(function(){
    $("form").submit(function(){
        var str = $(this).serialize();
        $.ajax({
            type : "POST",
            url : "ajax/form",
            data : str,
            dataType : "json",
            success : function(msg){
                alert(msg.message)
            }
        });
        return false;
    });
});

Now it works perfectly.


Messages In This Thread
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 10:26 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 10:38 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 10:40 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 12:43 PM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 12:53 PM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 12:56 PM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 01:21 PM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 03:15 PM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 02-28-2010, 07:03 PM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 03-01-2010, 03:33 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 03-01-2010, 03:37 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 03-01-2010, 08:22 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 04-01-2010, 07:54 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 04-01-2010, 08:09 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 04-01-2010, 08:13 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 04-16-2010, 07:51 AM
Return values from CI controllers to Javacript (jQuery) - by El Forum - 04-16-2010, 08:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB