.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

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

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
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.

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

InvalidOperationException error with jquery call to webmethod

Hi, I'm having an issue which results in returning the following from XHR requests to an webmethod on my form. {"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}Simplified form Code is as follows. [WebMethod]        public string LoadContact()        {            return string.Format("Hello From Server");        }I'm using JQuery to make the call: $.ajax({            type: "POST",            url: "SYS_AjaxResearch.aspx/LoadContact",            data: "{}",            contentType: "application/json; charset=utf-8",            dataType: "json",            success: function(msg) {                $("#topPanel").text(msg.d.LoadContact);   

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.  

Getting "401 Unauthorized" error with jquery call to webmethod


Hello folks,

I have been struggling to get my jquery call to a webmethod to work. I am being bounced by the server with a "401 Unauthorized" response. I must have an incorrect setting in the web.config or somewhere else that would be preventing a successful call.


jquery runtime error: Microsoft JScript runtime error: 'nodeName' is null or not an object


Microsoft JScript runtime error: 'nodeName' is null or not an object

in jquery-1.4.2.min.js 

jquery.tmpl error - object does not support this property


trying a sample from the jquery template plugin. Getting an error:

Microsoft JScript runtime error: Object doesn't support this property or method

    $.tmpl(tmpl, dataObject)

what do I need to run the templating plugin?

here are my script includes ( I added the jquery.tmpl.js file as an existing item to the scripts folder of my MVC project )

    <script type="text/javascript" 

<script src="~/Scripts/jquery.tmpl.js" type="text/javascript"></script>


Returning reference value from AJAX web method call on JQuery


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";

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

how to make VS Intellisense show complex object's properties for result of Ajax call?



I've create a WCF webservice and created a proxy to the service using ScriptManager.

I can see the created a proxy class, and intellisense pops up the methods of the webservice (great!!). But, I can't see the properties of the method params, return types.

The webservice method:

searchResponse DBSearch.Search(searchRequest)

have comlex types as a parameter (searchRequest) and a return type (searchResponse).

Intellisense does recognize these types, but I can not see the properties (javacript does);


var _searchRequest = new DBSearch.SearchRequest; (intellisense knows type SearchRequest)

_searchRequest.query = "liver lacerations"; (intellisense doesn't know it's property 'query')

_searchRequest.searchOptions = "modality=mri";

Obviously, with javascript, var _searchRequest is not typed, but is there a way to hint intellisense into the properties of the class?



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

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

Sending js Array object in jQuery Ajax post

The article Sending js Array object in jQuery Ajax post was added by tmorton on Thursday, May 12, 2011.

The post name should be "Serializing to JSON in jQuery" or something like that but I kind of twisted it the way I faced this issue. If you're looking for how to do the ajax calling in jQuery and blah da. then you should keep googling cause this post ain

Help - Cannot call webservice Get error: Server was unable to process request. --> Object reference

Here is my code, I don't fully understand the erro because I have instantiated all objects
Any help or advice appreciated.
Dim transactionResult As PremiumCredit.TransactionResult = New PremiumCredit.TransactionResult
        Dim newBusiness As PremiumCredit.NewBusiness = New PremiumCredit.NewBusiness
        Dim transferEngine As PremiumCredit.XMLTransferEngine = New PremiumCredit.XMLTransferEngine
        'Build up NewBusiness Object
        newBusiness.AddCoverCode = String.Empty
        newBusiness.BankAccountName = Session("BankAccountName").ToString
        newBusiness.BankAccountNumber = Session("BankAccountNumber").ToString ' 02149187
'Populate the rest of new Business object etc
        System.Net.ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf ValidateCertificate)
            transactionResult = transferEngine.Crea

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.
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