473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

AjaxPro and jQuery

I'm not sure if this belongs on this forum, but if anyone is still using AjaxPro, I'm trying to get it to work with jQuery. I keep getting errors returned similar to this one: null; r.error = {"Message":"word s","Type":"System.NotSupportedException"};/*. Below is the relevant code. Thanks for your help.

C# code:
Expand|Select|Wrap|Line Numbers
  1. using AjaxPro;
  2.  
  3. public partial class _Default : System.Web.UI.Page
  4. {
  5.    protected void Page_Load(object sender, EventArgs e)
  6.    {
  7.        //load ajax.net files
  8.        string path = "/ajaxpro/_Default,";
  9.        path += typeof (_Default).Assembly.FullName.Split(',')[0];
  10.        path += ".ashx";
  11.        Page.RegisterHiddenField("ajaxProPath", path);
  12.    }
  13.  
  14.    [AjaxPro.AjaxMethod()]
  15.    public int deleteService(int lineNumber)
  16.    {
  17.        return lineNumber;
  18.    }
  19. }
  20.  
.JS Code
Expand|Select|Wrap|Line Numbers
  1. $(document).ready(function()
  2. {
  3.     $("img[@id*=delete]").click(function()
  4.     {
  5.         var btnID = $(this).attr('id');
  6.         btnID = btnID.substring(6, btnID.length);
  7.  
  8.         if (confirm('Are you sure you want to delete service # ' + btnID + '?'))
  9.         {
  10.             $.ajax({
  11.                type: "POST",
  12.                url: $("#ajaxProPath").attr('value'),
  13.                data: {s: btnID},
  14.                beforeSend: function(xhr)
  15.                {
  16.                  xhr.setRequestHeader("X-AjaxPro-Method", "deleteService");
  17.                },
  18.                success: function(s)
  19.                {
  20.                     alert(s);
  21.                }
  22.             });
  23.         }
  24.     });
  25. });
  26.  
  27.  
Jun 11 '08 #1
8 5746
Plater
7,872 Expert 4TB
Which line triggers that error?
It sounds like the error is occuring in your backend code, since that error is showing a managed(.NET) excepetion code
Jun 11 '08 #2
Which line triggers that error?
It sounds like the error is occuring in your backend code, since that error is showing a managed(.NET) excepetion code
I don't get a detailed error message back; it comes up through the alert box as part of the response. If I had to guess though, it may have something to do with how I'm setting up the data in the JS Code.

JS Code:
Expand|Select|Wrap|Line Numbers
  1. $(document).ready(function()
  2. {
  3.     $("img[@id*=delete]").click(function()
  4.     {
  5.         var btnID = $(this).attr('id');
  6.         btnID = btnID.substring(6, btnID.length);
  7.  
  8.         if (confirm('Are you sure you want to delete service # ' + btnID + '?'))
  9.         {
  10.             $.ajax({
  11.                type: "POST",
  12.                url: $("#ajaxProPath").attr('value'),
  13.                data: {s: btnID},
  14.                beforeSend: function(xhr)
  15.                {
  16.                  xhr.setRequestHeader("X-AjaxPro-Method", "deleteService");
  17.                },
  18.                success: function(s)
  19.                {
  20.                     alert(s); // here is where error message is shown
  21.                }
  22.             });
  23.         }
  24.     });
  25. });
  26.  
  27.  
Jun 11 '08 #3
Plater
7,872 Expert 4TB
So you can't debug through your server-side code and find any problems?
Jun 11 '08 #4
So you can't debug through your server-side code and find any problems?
I'm not using Visual Studio if that's what you're asking.
Jun 11 '08 #5
Plater
7,872 Expert 4TB
I'm not using Visual Studio if that's what you're asking.
Then what are you using? That was clearly c# code (for asp.net) in the first code block.
Jun 11 '08 #6
Then what are you using? That was clearly c# code (for asp.net) in the first code block.
I'm just coding by hand in Dreamweaver.
Jun 11 '08 #7
Plater
7,872 Expert 4TB
Well Visual Web Developer has a free edition. You could try using that.

I really think it is a problem in the .NET code and not your javascript.
Jun 11 '08 #8
I know this is an old post, but I thought I would shed some light on this issue in case anyone comes across this post. The error "Word s" NotSupportedException is referring to the property name "s" in the data that is being sent in JQuery's AJAX Method. This property must match the parameter name in the AjaxMethod on the server side. Therefore the correct data parameter to pass in the JQuery AJAX Method is
data: {lineNumber: btnID}
Nov 12 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: 20002937 | last post by:
Hi All, I am using AjaxPro dll in my ASP.Net application. Here, I found that all the objects of the classes in the AjaxPro namespace are not released. They are alive in all the pages.I found this...
1
by: DuaneMoraes | last post by:
A new book on jQuery, the powerful JavaScript library, has been announced by Packt In Learning jQuery, Karl Swedberg and Jonathan Chaffer, creators of the popular jQuery learning resource...
1
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
20
by: Aaron Gray | last post by:
There does not seem too be anyway to test if two jQuery references are the same element. Given :- ... <div id="1"></div .... Then :- alert( $("#1") == $("#1"))
26
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
2
by: souporpower | last post by:
Hi All I am trying to print some HTML using JQUERY. I am posting the code. I don't see the alert. It seems as though the function is not registered when the document is loaded. Can someone...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.