HI,
i am new to JQUery and Ajax.I am trying to use the value returned from the Ajax call to the another Ajax call..
like
$.ajax({
type: "POST",
url: "http://localhost/FormBuilder/index.php/forms/saveForm/",
async: false,
data: "formname="+formname+"&status="+status,
success: function(msg){
//alert( "Data Saved: " + msg);
getformid=msg;
}//success
});//ajax
$("#fb_contentarea_col1down21 div").each(function() {
//alert("Form id "+getformid);
var checked="false";
var id=$(this).attr("id");
//var fname=$("#label"+id+"").text();
var fsize=$("#input"+id+"").width();
var ftype=$("#input"+id+"").attr('data-attr');
var finstr=$("#instr"+id+"").text();
var fname=$("#label"+id+"").clone().html().replace(/<span.*/,'');
if($("#label"+id+"> span.req").length > 0)
{
checked="true";
}
$.ajax({
type: "POST",
async: false,
url: "http://localhost/FormBuilder/index.php/forms/saveField",
data: "sequence_no="+id+"&name="+fname+"&type="+ftype+"&size="+fsize+"&instr="+finstr+"&formid="+getformid+"&required="+checked,
success: function(msg){
//alert( "Data Saved: " + msg);
}//success
});//ajax
The First Ajax call returns the Formid and even alerts it correctly in the Div ,But the returned value in getformid is not reflected in the second ajax call . Please sugggest me