post data with a variable name use jquery
$('i.icon-angle-up').on('click', function() {
var data = {$(this).attr('name') : 'asc')}
$.post('', data, function() {
window.location.reload();
});
});
i want post some data to server,but the name of the data comes from a
variable($(this).attr('name')), how can i do?
i have tried
$.post('', {"$(this).attr('name')" : 'asc')}, function() {
window.location.reload();
});
but it don't go well.
Thank you all.
No comments:
Post a Comment