this.formsValidation = function(form_id)
{
    var fieldNames;
    jQuery.post('index.php','option=com_itcs_forms&controller=itcs_fields&task=getFieldsNameForValidation&tmpl=component&form_id='+form_id,
    function(data)
    {
        fieldNames = data;
    });
    alert(fieldNames);
    return false;
}
here "fieldNames" is showing "undefined" although it must show a string which is in "data". i am unable to store "data" to a variable, so that i can work with it after "post" function. how to do that?
 
     
    