Welcome Guest, Not a member yet? Register   Sign In
Calling to a method controller from jQuery
#1

[eluser]Jose DueƱas[/eluser]
Hi,
I've a controller which inserts into a databse an user:

Code:
class Users extends Controller {
    
    function insert_user()
    {
             $this->Usersmodel->insert("John Smith");
    }
}

What I want to do is do that with jQuery, I've tried from the view:

Code:
$.ajax({url:"http://localhost/index.php/users/insert_user",
                success: function() {
                    // Request has been successfully submitted
                    alert("Succeeded");            
                },
                  error: function() {
                    // An error occurred, do something about it
                    alert("Failed");
                   },
                complete: function() {
                    // We're all done so do any cleaning up.
                    alert("Process has been done");
                }
               });

And I always getting "Failed". It's because I'm trying to load something is not a script.

How could I do this?

Thanks,
Jose


Messages In This Thread
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 04:57 AM
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 05:13 AM
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 05:18 AM
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 06:02 AM
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 06:03 AM
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 01:34 PM
Calling to a method controller from jQuery - by El Forum - 03-23-2009, 01:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB