Question

I have been experimenting with Jeditable, and i have got it to update normal tags as .edit... but it will not update

with .editArea Plus when it updates the normal the update is not shown until i update the page..

I am not sure what i am doing wrong, and some help would be appreciated :)

Code:

    <div>
<h2 id='<?= $row['id']?>' class="edit"> <?= $row['title']?></h2>
<p class="editArea"><?= $row['Text'] ?></p>
</div>
<?php

} ?>

$(document).ready(function() { var text = 20;

 $('.edit').editable('http://www.JapSeyz.dk/save.php?type=header', {
     indicator : 'Saving...',
     submit : 'OK',
     id   : 'id',
     name : 'value',
     tooltip   : 'Click to edit...'
 });
 $('.editArea').editable('http://www.JapSeyz.dk/save.php?type=text', { 
     type      : 'textarea',
     submit    : 'OK',
     id   : 'id',
     name : 'value',
     rows : '6',
     cols : '100',
     indicator : '<img src="img/indicator.gif">',
     tooltip   : 'Click to edit...'
 });

}); (I left all the require/styling etc out.. )

And the update script

<?php
require("Oese/Connection.php");

$type = (isset($_GET['type'])) ? $_GET['type'] : "";
$value = (isset($_POST['value'])) ? $_POST['value'] : "";
$id = (isset($_POST['id'])) ? $_POST['id'] : "";


if($type == "text"){
mysql_query("UPDATE Oese SET Text='$value' WHERE id='$id'");
}
elseif($type == "header"){
mysql_query("UPDATE Oese SET title='$value' WHERE id='$id'");
}
print $value;
?>
Was it helpful?

Solution

In the options you're passing id : 'id', this may be overwriting the value sent by jeditable.

Try removing this and see. Otherwise, var_dump($_POST) on the server and see what is actually sent (on Chrome developer toolbar, check the Network tab).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top