this should help you debug the issue
$('#rename').click(function () {
//alert( $(this).closest('td').prev().prev().text());
var name = prompt('enter the new name');
if (name) $.ajax({
url: url() + '/rename',
type: 'POST',
data: { value: name,
id: $(this).closest('tr').find('td :first').attr('value')
},
success: function (result) {
alert('success');
if (result.content == 1) {//location.reload();
alert(name);
//$(this).closest('td').prev().prev().text(name);
}
},
error: function () {
alert('error');
}
})
});
basically added a couple of extra points.
- How do you know success is happening and result.context just isn't equal to 1, so added the alert('success');
-
How do you know it's resturning success at all? Added
error: function () { alert('error'); }
-
you were missing a ; at the end. :)