您应该使用的概念。是Ajax。
浏览器的每次点击和其他事情只发生在客户端(浏览器)上。
- 然后当你点击。浏览器向服务器发送请求。
- 服务器,获取您从浏览器发送的值并进行处理。
一些简单的可能是:
//的Html
<a id="linkone" href="laggtill.php">+</a>
<a id="linktwo" href="laggtill.php">+</a>
//使用Javascript
// Use jquery
$("#linkone").on("click", function(){
//function that send request to server
$.post('someurl.php', {})
.success(function(res){
console.log(res);
// If you stay here, the procces should be ended
})
// if you return false, the click dont redirect other window
// if you return true, the click redirect other window
return false;
});
// PHP的第一个链接文件
<?php
//capture values
// But only is a clic, then there is not values
session_start();
$_SESSION['car'] = $_SESSION['car'] + 1;
// If you want some simple, one file only works for one link
// For the other link, you should create other file same to this.
header("Location: betalning.php"); // With ajax dont use this line,
?>
来源
2014-12-13 01:12:31
ray
你想要通知页面还是服务器? – jasonszhao 2014-12-13 01:15:11
http://api.jquery.com/click/这是你在找什么? – jasonszhao 2014-12-13 01:17:30