One, JS code
<script type= "Text/javascript" >
$ ("#save_change_ <{$aff. Id}> "). Click (function () {
Take values from modal boxes and upload them to the background via Ajax
var account = document.getElementById ("change_account_<{$aff. Id}> "). Value;
var password = document.getElementById ("change_password_<{$aff. Id}> "). Value;
var transactioncrawled = document.getElementById ("change_transactioncrawled_<{$aff. Id}> "). Value;
$.ajax ({
Type: "POST",
URL: "b_aff_aff_change.php",
DataType: "JSON",//when the foreground page to get backstage Msg.account and Msg.password is, not marked DataType: "JSON", is not get the value!!!
Data: "account=" +account+ "&id=<{$aff. Id}>&password= "+password+" &transactioncrawled= "+transactioncrawled,//similar to URL get parameters, multiple values directly add &, variable with + To connect
Success:function (msg) {
Change the TD value of the current page by JS
document.getElementById ("account_<{$aff. Id}> "). InnerHTML = Msg.account;
document.getElementById ("password_<{$aff. Id}> "). InnerHTML = Msg.password;
document.getElementById ("transactioncrawled_<{$aff. Id}> "). InnerHTML = Msg.transactionCrawled.toUpperCase ();
}
});
});
</script>
Second, the background page b_aff_aff_change. Php
<?php
echo Json_encode ($_post); In contrast to the datatype: "JSON" in Ajax, you must first convert the $_post array to JSON format
?>
JQuery Ajax How to pass multiple values to the background page, for example: