How do I pass the value in jquery to PHP in the current page (without refreshing the page)? , please give me a sample code.
Reply to discussion (solution)
$.ajax ({url: "test.php", Context:document.body, Success:function () {
$ (this). AddClass ("Done");
}});
$.post ("btdz.php", {title:i,action:1},function (data) {
alert (data);
});
})
Not refreshing is not possible, local refresh.
Set up two pages for a.php and b.php, respectively
a.php
b.php
I wrote to someone before. A registration page: http://bbs.csdn.net/topics/390398302, the 17 floor.
Thank you, I'm not clear about the problem, I mean refresh the contents of a local div in the page based on the new value of the variable
JS Dom operation is possible.
var s= ' xxxx ';
document.getElementById (' div '). Innerhtml=s;
Thank you, I'm not clear about the problem, I mean refresh the contents of a local div in the page based on the new value of the variable
I don't know what that means.
Landlord may be your idea of the starting point there is a problem.
First, PHP is a server-side scripting language, and the pages you get are static HTML pages that have been parsed by the PHP server.
If you want to implement the content of the page without flushing, you can asynchronously want PHP to send the request to get the data and then use jquery to manipulate the DOM.
It is not possible to pass a jquery variable value to PHP on the current page without going through the server.
Thank you, knot-stickers.