How to access attributes value as params in x-editable?

June 13, 2018 | Category : JQuery Plugin JQuery

a few days ago I was working on my PHP laravel project with x-editable js. actually, I can say x-editable is amazing. everything was working fine with pk and value parameter. but I also need to add another custom parameters. I set with an attribute but can't get of ajax file. So I was confused with that.

I search on google and found solution of my problem. we can also add another parameter with data attribute. so you can set attribute and pass that attribute in your ajax POST, GET, PUT method also. So your solution is here.

Set Attribute:

<a href="#" data-title="Enter Translate" class="translate" data-code="en" data-type="textarea" data-pk="" data-url="/ajax-post">My Message</a>

Pass Params:


params: function(params) {

// add additional params from data-attributes of trigger element

params.code = $(this).editable().data('code');

return params;


success: function(response, newValue) {

alert("Translate updated successfully.");



it's very small example but can help you...

Thank you...