0

Jeditable is saving data to the file like:

$('.edit_area').editable('http://www.example.com/save.php', { 
         type      : 'textarea',
         cancel    : 'Cancel',
         submit    : 'OK',
         indicator : '<img src="img/indicator.gif">',
         tooltip   : 'Click to edit...'
     });`

How do I replace JQuery.ajax with admin-ajax.php? Do I just replace http://www.example.com/save.php to admin_url('admin-ajax.php')?

  • Have you tried just replacing it? Btw: That's a snippet. You'll have to show a) your whole code and b) show what you already tried/what your problem is. – kaiser Feb 7 '12 at 7:29
  • Sorry. I finded solution after posting this question. This plugin working with url like: <?php echo admin_url('admin-ajax.php'); ?>?action=youraction – Bohdan Hdal Feb 7 '12 at 9:09
  • 1
    You should post that as an answer. Might be useful for later readers. You can mark it as solution in 2 days. – kaiser Feb 7 '12 at 9:11
1

Here is another way:

$('.editable').editable(function(value, settings) { 

 $.post(
    ajaxurl,
    { action: 'ajax_action',
              data: data,
              moreData: moreData
    }, function(response) 
               {

           });

      return(value);
 }, 

 { 
   submit: 'Ok',
   tooltip: 'Click to edit title',
   cancel    : 'Cancel',
   event     : "dblclick"
 });

where value is what has been inserted in the editable field.

0

I found a solution for my question. This plugin works with url formatted like:

$('.edit_area').editable('<?php echo admin_url('admin-ajax.php'); ?>?action=youraction', {
     type      : 'textarea',
     cancel    : 'Cancel',
     submit    : 'OK',
     indicator : '<img src="img/indicator.gif">',
     tooltip   : 'Click to edit...',
     somekey   : 'somevalue'
 });`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.