Welcome Guest, Not a member yet? Register   Sign In
CI workin with prototype.
#1

[eluser]edwin87[/eluser]
Hello CI,

For my work i need to figure out if AJAX libraries like: Prototype or jQuery work with CodeIgnitor.

I'm trying to implement Prototype to a standard form.

In the header i have the following code:
Code:
[removed]

window.onload  = function(){

// This 'observes' our form submit - sort of like onsubmit
$('my_form').observe('submit', function(evt) {

    // Stop the actual event from happening
    evt.stop();

    // This is the url we submit to - change it as needed
    var url = 'http://localhost/ajax/index.php/pages/id/3/edit/3';

    //This will be the div we update, in our case it's form_wrapper
    var container_div = $('content');

    // Grab all the info in the form
    var form_data = $('my_form').serialize();

    // Here we make the request
    new Ajax.Request(url, {
        method: 'post',
        parameters: form_data,
        onCreate: function() {
            container_div.update('Loading....');
        },
        onSuccess: function(transport) {
            container_div.update(transport.responseText);
        }
    },true);
});

}
[removed]

It works realy good. But, when i submit the page, the responseText is the whole website instead he's only showing the form in the content div.

How can i solve this problem?

I've searched the whole forum but can't find any suggestions.

Also i'm curious in what type ajax librarie's you are using, and why.

Maybe can somebody help me here?

I'm using also HMVC if it makes a difference.


Messages In This Thread
CI workin with prototype. - by El Forum - 10-30-2008, 01:08 PM
CI workin with prototype. - by El Forum - 10-30-2008, 02:07 PM
CI workin with prototype. - by El Forum - 10-30-2008, 02:20 PM
CI workin with prototype. - by El Forum - 10-30-2008, 02:29 PM
CI workin with prototype. - by El Forum - 10-30-2008, 02:31 PM
CI workin with prototype. - by El Forum - 10-30-2008, 02:48 PM
CI workin with prototype. - by El Forum - 10-30-2008, 03:25 PM
CI workin with prototype. - by El Forum - 10-30-2008, 04:18 PM
CI workin with prototype. - by El Forum - 10-31-2008, 05:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB