I'm looking at a few Stack Overflow threads in regards to implementing the jQuery ajax method:
How to pass parameters in GET requests with jQuery
While this thread provides some really good info, I'm looking for clarification on whether this will actually do what I think it will do.
I have the ajax GET request within a jQuery click function:
//click an image
$(".img_div").click(function() {
//get integer stored in element attribute and put it in variable
var altCheck = $(this).find('.modal_img').attr('alt');
//get MySQL data
$.ajax({
url: "get.php",
type: "get"
data: {
ajaxid: altCheck //variable from above - is this correct?
}
....
....
});
In get.php, I want the variable to be used like this:
$sql = "SELECT * FROM table WHERE screeningId = $ajaxid";
Essentially, I'd like to modify my SQL statement by passing a variable into the AJAX request, but I'm not sure if this is how it's done.