Reputation: 565
How can I get this link to open as a popup perhaps with ajax?
<a href="page.php?catId=<?php $row['catId'];?>&userId=<?php $row['userId']; ?>">
With the variables transfered to the popup.
I quite like the ajax modal popup, but don't know how to pass php varaiables.
Thanks
Upvotes: 0
Views: 297
Reputation: 1373
You can pass the link to javascript:
var myHTML= '<html>' +
'<body>' +
'<div>' + page.php?catId=<?php $row['catId'];?>&userId=<?php $row['userId']; ?> + '</div>+
'<!-- other html here -->' +
'</body>' +
'</html>';
var myPopup= window.open('http://www.domain_here.com/mypopup.html','mywindow','width=500,height=500,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0');
myPopup.document.open();
myPopup.document.write(myHTML);
myPopup.document.close();
Upvotes: 1
Reputation: 8889
Try to use jQuery and it's section called data.
$.ajax({
type: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
Upvotes: 0
Reputation: 3178
In page.php, you get the query string like this:
$catId = $_GET['catId'];
$userId = $_GET['userId'];
Upvotes: 1