Reputation: 1596
I have a modal window that uploads files to server. Works great. Upon completion of the upload I am refreshing a div on the parent page. Almost works. What I need in order for it to work is to be able to grab $_GET['edit']. Hopefully my layout of the code will help show my issue.
Modal Window: upload complete
$('#albumFinished').click(function() {
$('#sortableImages').load('../includes/sortImages.php');
});
sortImages.php
$galleryID = $_SESSION['newGalleryId'];
$getGalleryID = $_GET['edit'];
echo "<ul>";
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$sortImageName = $row['OrgImageName'];
$sortPath = "../data/gallery/" . $getGalleryID . "/images/album/" . $sortImageName;
echo "<li class='sortPhotos' id='recordsArray_{$row['id']}' >";
echo '<img src="'. $sortPath .'"/>';
echo "</li>";
}
echo "</ul>";
Everything is functioning properly except I am unable to grab the $_GET variable. How do I go about grabbing this variable? Also if my explanation is not clear, I will try to clarify further.
Upvotes: 0
Views: 213
Reputation: 1720
The load
function include an extra param called data
. This param is the one you have to use to pass parameters to the server via GET
method. For example:
$('#albumFinished').click(function() {
$('#sortableImages').load('../includes/sortImages.php',
{newGalleryId: 'specify_an_id', edit: 'some_value'});
});
The third line pass the specified parameters and values to the server. Where you will be able to grab them
Upvotes: 0
Reputation: 1470
I'm sorry maybe I'm not understanding but your not actually sending any data to the sort images.php to get with $_get your simply doing a load which is identical to just typing that url in your browser
try using $.post or $.get or $.ajax to send your get info over similar to this
$.get("../includes/sortImages.php", { edit: "what your editing"},
function(data){
return your data here
});
Upvotes: 2