Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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')?

share|improve this question
    
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  
Thank you for instructions! :) –  Bohdan Hdal Feb 7 '12 at 9:23

2 Answers 2

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.

share|improve this answer
up vote 0 down vote accepted

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'
 });`
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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