Why is my jQuery jEditable, edit-in-place callback not working?

Posted by unknowndomain on Stack Overflow See other posts from Stack Overflow or by unknowndomain
Published on 2010-03-24T00:27:30Z Indexed on 2010/03/24 0:33 UTC
Read the original article Hit count: 659

Filed under:
|
|
|
|

I am using a jQuery jEditable edit-in-place field but when the JSON function returns and I try to return a value from my edit-in-place callback all I get is a flash of

You can see this here...

http://clareshilland.unknowndomain.co.uk/

Hit Ctrl+L to login...

Username: stackoverflow
Password: jquery

Although you can see the script in /script.js here is the main code exerpt...

$('#menu li a').editable(edit_menu_item, { cssclass: 'editable' });

Here is the callback:

function edit_menu_item(value, settings) {

 $.ajax({
  type : "POST",
  cache : false,
  url  : 'ajax/menu/edit-category.php',
  dataType: 'json',
  data : { 'id': this.id, 'value': value },
  success : function(data) {

   if (data.status == 'ok') {
    alert('ok');
    return data.title;
   } else {
    alert('n/ok');
    return this.revert;   
   }

 }});

}

The JSON code is here: ajax/menu.edit-category.php

The edit-in-place is is on the menu which also has a jQuery sortable on it. Single click to edit. Enter to save, and it stores the data but does not update it on the edit-in-place field.

Please help stackoverflow, I have been working on this for a mega age.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jeditable