Friday, 7 February 2014

working with JSON calling Type ' POST '

('#btnsendoffer').live('click', function () {
    $('.loadingoffer').show();
    $('#sendoffer').css('display', 'none');
    try {
   /*---( offerterm is ddl selected value )---*/
 var _OfferTerm = $("#ddlofferterm option:selected").val();
    var _OfferExp = $('#txtofferexpires').val();
    var _OfferDesc = $('#txtofferdescription').val();
    //alert(_Ichkoffer)
    if (_CampaignId != '' && _Ichkoffer != '' && _OfferExp != '') {
        $.ajaxSetup({
            cache: false
        });
        $.ajax({
            type: 'POST',
            url: '../web/Login.asmx.aspx/MakeOffer',
            data: '{"strCampaignID":"' + _CampaignId + '","strInfluencerIDs":"' + _Ichkoffer + '","strOfferExp":"' + _OfferExp + '","strOfferTerm":"' + _OfferTerm + '","strOfferDesc":"' + _OfferDesc + '"}',
            contentType: 'application/json; charset=urf-8',
            cache: false,
            datatype: 'json',
            success: function (makeoffer) {
                if (makeoffer.d == '') {
                    $('.divofferpopup .divoffercontent').html('<font style="font-size: large; color: red;">Failed to send Offer</font><br/><br/><font>Please contact FYI Team.</font><br/>)
                }
                else {
                    $('#sendoffer').css('display', 'none');
                    $('.divofferpopup .divoffercontent').html('<font style="font-size: large; color: green;">Offer(s) Sent Successfully</font>').css({ "display": "block", "text-align": "center" });
                }
            },
            error: function (xhr, msg) { },
            complete: function (xhr, status) {
                $('.loadingoffer').hide();
            }
        });
    }
    else { alert('Please check the inputs'); return false;}
    } catch (error) {
        $('.loadingoffer').hide(); hideofferpopup();
    }
});

No comments:

Post a Comment

Extracting Nupkg files using command line

Rename it to zip first then extract files as below 1.     Rename-Item -Path A_Package.nupkg -NewName A_Package.zip 2.     Make sure to repla...