Click here to Skip to main content
15,888,202 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can anyone please give me solution for my problrm
here in my jquery ajax call there is no issue in local machine.but when i hosted it in server am not getting any response.is there any thing wrong in my code.
thanks in advance.

What I have tried:

JavaScript
function save(did, ih) {

    var dashid1 = parseInt(did);
    var isHome = parseInt(ih);

    var records = [];
    $(".addWidget").each(function () {
        var arrayContent = $(this).attr("content").split('_');
        var LI = '#li_Tab_' + arrayContent[1];

        var DashboardNameForContent = $(LI).find('a').html();
        var record = {
            UserID: $("#hdnlogin").val(),
            DashboardID: arrayContent[1],
            DivID: arrayContent[2],
            ContainerID: arrayContent[3],
            WidgetTitle: arrayContent[4],
            DataType: arrayContent[5],
            Width: arrayContent[6],
            TabName: DashboardNameForContent
        };

        records.push(record);
    });

    var jsonArray = (JSON.stringify(records));

    $.ajax({
        type: "POST",
        url: 'HomeDashboard.asmx/AddDashboardRecord',

        data: JSON.stringify({ dasboardrecord: jsonArray, did: did, IsHome: isHome }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (result) {
            if ($('#divConfirm').is(":visible"))
                $("#divConfirm").dialog("close");

            if (result) {
                if (ih == 1) {

                    var unfilltabid = $(document).find('input[src="Images/Home_fill_16_16.png"]').attr('id');
                    $('#' + unfilltabid).attr("src", "Images/Home_unfill_16_16.png");
                    var HomeId = 'imgHome_' + did;
                    $('#' + HomeId).attr("src", "Images/Home_fill_16_16.png");
                    OpenAlert('Your Home page changed successfully');
                }


                else if (ih == -1) {
                    //alert("Record saved successfully");
                    OpenAlert('Record saved successfully');
}}
Posted
v2
Comments
Peter Leow 30-Dec-16 9:19am    
check that the url path is correct after migration as the configuration on server is bound to be different from that of the local machine.
Member 12928324 2-Jan-17 3:01am    
i checked the url path after migration.there is no issue on that.if there is no data on in my array it is hitting the service method.if there is any data it is not hitting the method.
Check the network tab in developer tool. You can find the request and response details. If there is any error, it will show there.
Member 12928324 2-Jan-17 2:59am    
i didnt get you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900