I've coded a bookmarklet that opens a new window at a certain URL and sends some variables to a PHP using GET. The problem is I need 开发者_如何学编程to have it load the same php and send the same variables but inside a div this time.
Could anyone point me in the right direction please?
Client Side - JavaScript & jQuery
jQuery provides a GET operation using AJAX, for example $.get("test.php");
See Ajax/Query.get docs for more info: arguments, examples, etc.
The version to send GET variables is $.get("test.php", { name: "John", time: "2pm" } );
jQuery is an API layer on top of regular JavaScript that simply wraps the lower-level features and expresses them in a somewhat cross-browser compatible way.
Server Side - PHP
This w3schools page shows a sample of a PHP page picking up GET data from an AJAX call:
<?php
$name=$_GET["name"]; // John
$time=$_GET["time"]; // 2pm
精彩评论