Younger brother my php code and html code are on the same page. I use $. ajax to pass my own values to younger brother. I want to implement the modification function-php Tutorial

Source: Internet
Author: User
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.



Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.