Giter VIP home page Giter VIP logo

Comments (3)

vitalets avatar vitalets commented on May 18, 2024

hi,
just checked - yes, for submit api method POST is hardcoded. I will definetly change it to be an option in next release.
As local solution you can use getValue method to collect data from editables and submit them via ajax.
(see how it done here https://github.com/vitalets/x-editable/blob/master/src/element/editable-element.js#L418)

For individual submit it is already done in 1.1.1, have a look on #22

Thank you.

from x-editable.

gbouteiller avatar gbouteiller commented on May 18, 2024

What a quick answer! 👍
I've modified your code to use ajaxOptions in 'submit' : here what I've done :

(line 1425) case 'submit':  //collects value, validate and submit to server for creating new record
                var config = arguments[1] || {},
                $elems = this,
                errors = this.editable('validate'),
                values, ajaxOptions; // added var ajaxOptions

                if(typeof config.error !== 'function') {
                    config.error = function() {};
                } 

                if($.isEmptyObject(errors)) {
                    values = this.editable('getValue'); 
                    if(config.data) {
                        $.extend(values, config.data);
                    }
                    ajaxOptions = $.extend({ //extending ajax options with config.ajaxOptions
                        url     : config.url,
                        data    : values,
                        type    : 'POST',
                        dataType: 'json'
                    }, config.ajaxOptions); 
                    $.ajax(ajaxOptions).success(function(response) {

from x-editable.

thomas-louvigne avatar thomas-louvigne commented on May 18, 2024

thanks, it is exactly what i need !

from x-editable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.