My php code and html code are on a page, with $. the function php: & nbsp; $ obj $ _ GET [a]; the condition value $ obj1str_replace (& quot; & quot;, & quot;, $ _ GET [B]); changed value $ obj2 $ _ GET [c]; make sure that my php code and html code are on the same page. use $. I want to modify the function of passing a value to myself through ajax.
Php:
$ Obj = $ _ GET ['A']; // condition value used for judgment
$ Obj1 = str_replace ("", "", $ _ GET ['B']); // The changed value.
$ Obj2 = $ _ GET ['c']; // field name changed
If ($ obj1 ){
$ SQL = "update studentbase set $ obj2 = '$ obj1 'Where id =' $ obj '";
Mysql_query ($ SQL );
}
Js:
Var thisobj = $ (this );
Var idobj = nowtd. attr ("id"); // name of the field to be modified
Var parentobj = thisobj. parent ("td "). parent ("tr "). children ("td "). children ("# hid "). val (); // The condition id to be determined during modification
Var content = thisobj. val (); // The modified content is passed into the database.
Nowtd.html (content );
If (content! = ""){
$. Ajax ({
Type: "GET ",
Url: "user‑baodao_xingming.php ",
Data: {a: parentobj, B: content, c: idobj },
Success: function (data ){}
});
If you use this method to pass a value to the page and then modify the content, Chinese characters are garbled first. Why can't you pass the value to yourself or modify any configuration? the database is okay, chinese garbled characters are displayed as soon as this method is used!
------ Solution --------------------
Will garbled characters be cached after refresh?
You can set it like this. I usually use UTF-8 // File encoding to save it as UTF-8.