I'm trying to run two jquery ajax methods using post, the first step, submits the request, and returns job id, the second step should take the job id and pass it into another ajax function, I have tried the following, but passing the value to step 2, doesn't seems to work.
$(document).ready(function(){
$("button").click(function(){
// Step1: send request to cs1.php and return job id
$.get("cs1.php",function(data){
var jobid = data;
alert(jobid); // this works and returns job id
// Step2: use job id returned from step1 here
$.post('process.php', {jobid: jobid}, function(data) {
$('#div1').text(data);
});
});
});
});
</script>
Your help is highly appreciated.