2

When the form is submitted, its gets handles by JavaScript. From the JavaScript, I' am looping the serializeArray for the hidden field called "action".

/* This is the funtion that handles the action from .ajax-about form */
function ajax_about_birthday(dataArray){
    alert("Works!");
}

$("#about-form-horizontal .ajax-about").submit(function(){
    var form, dataArray, action;
    form = $(this).serializeArray();
    dataArray = form, dataObj = {};
    $(dataArray).each(function(i, field){
        dataObj[field.name] = field.value;
    }); 
    action = dataObj['action'];
    action(); // I' am stuck here, how will I call the function using the value from action variable
});

From the above code, I don't get any error on the Console.

Red Virus
  • 1,633
  • 3
  • 25
  • 34

0 Answers0