score:2

Accepted answer

You're getting a bit mixed up with asynchronous nature of AJAX.

The AJAX event is being fired, but it won't be causing any pause in the execution of your code, as such, you need to implement a callback.

This code isn't particularly nice, but it should give you an idea of how the data needs to be handled.

function setJSONSer() {
    formData = {
        'Email': 'clientlink@russell.com',
        'Password': 'russell1234',
        'URL': getVaria()
    };

    $.ajax({
        url: "/APIWebService.asmx/AnalyticsDataShowWithPost",
        type: 'POST',
        data: formData,
        complete: function(data) {
            console.log("Successfullly set JSON!");
            getJSONSer();
        }
    });
}

function getJSONSer()
{
    $.ajax({
        url: "/APIWebService.asmx/AnalyticsDataShowWithPost",
        type: 'GET',
        complete: function(data) {
            //alert("This is Get JSON Out  "+JSON.stringify(data));#
            Load(data);
        }
    });
}

function BeginLoad()
{
    setJSONSer();
}

function Load(data)
{
    setJsonSer();

    var labels = new Array();
    var values = new Array();
    var catogories = new Array();
    var arrayOfArray = new Array();

    var rowData = "return value of JSON.stringify(data)";
}

BeginLoad();

Related Articles