I need some help with ajax callbacks. I’m trying to pass certain parameters after ajax is being called
var dataString = 'string=' + string;
$.ajax({
type: "POST",
url: "file.php",
data: dataString,
success: function(data){
$(".selector").html(data)
}
});
Okay so if my file.php has some mysql queries and I’m trying to echo out values
echo $picture;
echo $title;
echo $additional_values;
How do I echo out certain values and pass it through ajax
So if I echo those out in my php file, and output it through my ajax function(data), it will output everything into $(".selector").html(data) (<div class="selector"></div>), however, I’m trying to output one thing at a time
success: function(data){
$(".picture").html(data); // echo's out picture in my picture div class
$(".title").html(data); // echo's out title in my title div class
$(".additional_values").html(data); // echo's out to the div class...
}
If someone can shine some light towards me, that’ll be great!
Thank you!
PHP
JavaScript