简体   繁体   中英

jeditable is updating mysql but returns headers in my php

i use the following script

$(document).ready(function() {
   $('.edit').editable('updateCat.php', {
       indicator : "Saving...",  
       submit   : 'OK'                  
 });  });

my editable point in my code is

while($row = mysql_fetch_array($result))
{ echo "<tr>";
echo "<td >" . $row['id_cat'] . "</td>";
echo "<td class='edit' id=".$row['id_cat'].">" . $row['title'] . "</td>";
...

my updateCat.php follows

<?php
 require_once 'base.php';
 $id = $_POST['id'];
 $newvalue =mysql_real_escape_string($_POST['value']);
 $result=mysql_query("UPDATE category_product SET title='$newvalue' WHERE id_cat='$id'") or die(mysql_error());
echo $newvalue;
 ?>

when i run my php code mysql gets updated but if i don't refresh my page and try to edit again i get this in my edit field:

     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Untitled Document</title>    asd  

where i should get only the edited content which in the above case would be asd. the problem appears if i try to edit the content again without refreshing. Also if i do this, mysql updates the content with Untitled Document which is quite frustrating. How can i solve this issue?

I came to this old question when the same issue occurred to me. There were headers in the php file with the mysql connection, removed the headers and the problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM