Search code examples
jqueryajaxx-editablebootstrap-table

x-editable: How to update the post URL itself with field values?


The API I'm attempting to post to is constructed as follows: /device/invoiceNumber/{invoiceNumber}/{portableUnitId}

where the values in brackets must be replaced with dynamically added values from the bootstrap-table. I can generate the custom URL in another function, but what I have here isn't working:

$(this).data('url', postInvNumUrl);

Any ideas?


Solution

  • I found the solution, you have to update the option on editable itself:

    // This is where the magic happens
    $(this).editable('option', 'url', postInvNumUrl);
    
    // Not sure if this is needed anymore 
    $(this).data('url', postInvNumUrl);