My little brother my php code and HTML code on a page, with $.ajax to the value of their own little brother I want to implement the modified function
Source: Internet
Author: User
My PHP code and HTML code on a page, with $.ajax to self-value I want to implement the function of modification
Php:
$obj =$_get[' A '];//condition value for judgment
$obj 1=str_replace ("", "", $_get[' B ');//The changed value
$obj 2=$_get[' C '];//changed field names
if ($obj 1) {
$sql = "Update studentbase set $obj 2= ' $obj 1 ' where id= ' $obj '";
mysql_query ($sql);
}
Js:
var thisobj=$ (this);
var idobj=nowtd.attr ("id");//field name to be modified
var parentobj=thisobj.parent ("TD"). Parent ("tr"). Children ("TD"). Children ("#hid"). Val ();//The condition ID to be judged when modifying
var content=thisobj.val ();//Change the contents of the incoming database
nowtd.html (content);
if (content!= "") {
$.ajax ({
Type: "GET",
URL: "user1_baodao_xingming.php",
Data:{a:parentobj,b:content,c:idobj},
Success:function (data) {}
});
Use this method to give themselves this page value and then modify the content will be the first Chinese garbled this is why can't give yourself value or modify what configuration, the database is no problem, is a use this method will appear in Chinese garbled!
------Solution--------------------
After the refresh will be garbled is not a cache
You set up this generally no problem, I generally use utf-8//File encoding Save as is also utf-8
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.