.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Returning reference value from AJAX web method call on JQuery

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :ASP.Net

I got this flag that I am checking for authenticated signed in users:


    <script type="text/javascript">
        $(document).ready(function () {
            $('#test').click(function () {

        function flag() {
            var _flag = "False";

View Complete Post

More Related Resource Links

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

Jquery Ajax Call to Mvc Action tips.


I try to do a ajax call via the jquery api.

The scritp :

$("#sortColumn").click(function(e) {
                var columnName = $(this).attr('name');
                var sidx = columnName;
                var sord = '<%= (string)ViewData["sord"] == "asc" ? "desc" : "asc"%>';
                var page = '<%= ViewData["page"] %>';
                var rows = "5";
                type: "POST",
                url: "/Mailings/GetData2",
                data: {'sidx': sidx ,'sord': sord ,'page': page ,'rows':  rows },
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(response) {
                var jsonObject = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
                error: function(xmlHttpRequest, textStatus, errorThrown) {
                    document.getElementById('infoContentHeader').innerHTML = xmlHttpRequest.responseText;


And the

Get xhr object in vb.net when error occured in ajax call using JQuery.

Hi Dude,   I have a big problem in Jquery ajax call. I am calling the web service whenever click the update button. I have a separate web service class, in which consist of few methods. When I calling the web service method, I have made the error handling and log the error information in db after that I have to override the "ex" that means error object to XMLHttpRequest. Is it possible to assign the sqlexception to ajax object (xhr) in vb.net? Please help me its much more useful for me.   Thank in advance.

jquery ajax call does not work after adding routes

Hi.   I've added routes to my asp.net 4 website so that, for example the page: "~/Main/About/Careers.aspx"  is mapped to the url:  http://localhost/mysite/careers/   I'm using jquery to make an ajax call and it simply does not work after I've added the routing, I used the following code, and it remains stuck on the spinner image:$.ajax({ type: "POST", url: "Careers.aspx/SubmitApplication", data: "{" + paramList + "}", contentType: "application/json; charset=utf-8", dataType: "json", beforeSend: function () { $(".applySpinner").show() }, success: function (msg) { $(".applySpinner").hide(); // Replace the div's content with the page method's return. if (msg.d == "") { $(".applySuccess").hide(); $(".applyFailure").show(); return; } else $(".applyFailure").hide(); $(".sentTime").text(msg.d); $(".applySuccess").fadeIn(1000); } }); Thanks.  

Jquery - Ajax Get Method


I have a web service:

public string GridAjx(int Input1, int Input2) 

I would like to use Jquery to make a link that reads GridAjx function using AJAX.
To retrieve the hidden parameters.
I found a solution through:
<a href="" rel="ID"> </ a>
But it would be only one parameter.
I need to pass two parameters.
Thanks for the advice.

jQuery's ajax to call web service that returns ado.net dataset to xml



     I try to use jQuery ajax to call web service that returns ado.net dataset which writes to xml, and after I get result client side, I will append to ol tag.

     It did not make it at the time of get result and try to loop the table tag.

     Thank you,





******* WebServiceCommon.cs    

    [ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
    public string GetAllLabsInXML()
        DataSet m_dsDataSet = new DataSet("pageDataSet");
        string m_szSQLConn = "Data Source=(local);Initial Catalog=abc;Integrated Security=False;uid=sa;pwd=abc;Pooling=false;";
        string _szSQL = @"Select LabID, Description From Lab";
        SqlConnection _objConn = new SqlConnection(m_szSQLConn);
        SqlDataAdapter _objDA = new SqlDataAdapter(_szSQL, _objConn);

        MemoryStream ms = new MemoryStream();
        m_dsDataSet.WriteXml(ms, XmlWriteMode.IgnoreSchema); 
        StreamReader sr = new StreamReader(ms, System.Text.Encoding.UTF8); 
        ms.Position = 0;
        String strXml = sr.ReadToEnd(); 

        return s

JQuery Autocomplete Call WCF Service Method


I am trying to use the below code to call a wcf service method for Autocomplete functionality in a TextBox.  I have written the following query:

$(document).ready(function () {
            $("#<%= txtCompany.ClientID %>").autocomplete(http://localhost/PieScore/PieScore.Application.Services/EmployeeService.svc/GetTestCompanyList, {
                dataType: 'json',
                parse: function (data) {
                    var items = data.d;
                    var parsed = [];
                    for (var i = 0; i < items.length; i++)
                        parsed[i] = {

JQuery function is not calling when JQuery Ajax method succeed


Hi I am doing a small application in asp.net using JQuery
<script language="javascript" type="text/javascript">
        $(document).ready(function() {
            var imgPoll = new Image();
            imgPoll.src = 'images/red-bar.png';
            if ($("#divVoted").length > 0) //Already

JQuery getJSON call to MVC Controller not returning data


This is probably something simple. The following JQuery call is executing can calling the controller and the controller is executing correctly. I used the sample data that's commented out to verify that the templates were working also.

However, the success function is not executing in the browser. Any thoughts or other ways I can debug this?

<script type="text/javascript">
@* var myData = [ {first: "Jane", last: "Doe"}, {first: "John", last: "Doe"} ]; *@

call Jquery ajax on ASP page loding.


Hi guys,

I want to avoid page refereshing or loding with the help of jquery ajax. Here i am attatch my asp page code.

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Shared/NimbleSchedule_H1_F1_L1.master"
    CodeBehind="DepartmentWizard.aspx.cs" Inherits="DepartmentWizard" %>
    <%@ MasterType VirtualPath="~/Shared/NimbleSchedule_H1_F1_L1.master" %>
<%@ Register Src="../Widgets/MyAccountNavigation.ascx" TagName="MyAccountNavigation"
    TagPrefix="NSMyAccountNavigation" %>
<asp:Content ID="cntHeader" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript" src="../Scripts/jquery.js"></script>
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('[id$=lnkCancel]').click(function () {
                return false;
                    type: "P

Problem in firefox and safari to call ajax method?


why does my below method not work with firefox and safari, every time it goes on OnFailed method?

is there setting requirement in browser to call page Method ?

also In IE method is calling sucessfully, but why alert message does not come ?

function SendMessage() {
      var user = document.getElementById('<%=User.ClientID %>');
      var val = user.value;
      var random = 2345;
      var nonRandom =12345;
        var toAddress = val;
        PageMethods.SendResetMailMessage(toAddress, random, nonRandom, CloseWindow, OnFailed);

    function CloseWindow(ret) {
      // Below code is usedOnClick="OnForgotPassword_Click" to close the window, if mail has been sent to the user sucessfully.
      if (ret == "1") {
        var windowObj = window.self;
        windowObj.opener = window.self;

Ajax call interrupting jQuery Draggable


I have a button that adds a set of div's to the page. Once these are added I then want to make a   "frame.draggable()" call in javascript. After this is done an Ajax call is made to another page to recieve some content for that frame. Everything seems to work fine the first time that I add a frame, but the draggable call fails on second and so on, but it works fine if i take out the Ajax call. 

 $('#content').append(frame); //Add Frame to content pane

 frame.draggable(); // Make frame Draggable

//Ajax call to get content
 $.get('DesiredContent.aspx', function (content) {
        frame.find('#myContent').html(content); });

return false;

If I comment out the Ajax call everything seems to work fine, however i dont get the content that i need. If i leave the call in then the second frame to be added will have the javascript fail at frame.draggable() saying that draggable is not a function. frame always has a unique id and if i put a break point in the javascript with firebug then i can get it to work as intended...

Cant figure this out, help would be much appreciated

Server validation is not firing if submited by Jquery $.ajax method


I am new in MVC.Using MVC2.MY create view is given below...

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Models.ExpenseCategory>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script src="<%=ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
        function SaveExpenseCategory() {
            try {

                var requrl = "/ExpenseCategory/Create";
                var formID = "frmAddEC";
                var serdata = $(frmAddEC).serialize();


jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

Use jQuery and ASP.NET AJAX to build a client side Repeater

By sending only data to the client, you can profoundly reduce the size of what you send and see a substantial increase in performance. You also allow yourself the ability to easily add features like light-weight sorting and paging on the client. This can not only improve your users' experience, but reduce server load and bandwidth requirements.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend