Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6384125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:44:10+00:00 2026-05-25T02:44:10+00:00

this way i am calling my server side code….my code as follows. $(function ()

  • 0

this way i am calling my server side code….my code as follows.

$(function () {
    $('#btnSubmit').click(function () {

        $.ajax({
            type: "GET",
            url: "MyPage.aspx?id=201/GetData",
            data: {},
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
            }
            ,
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
            }
        });
        return false;
    });
});

i doubt i am getting error because url is wrong url: “MyPage.aspx?id=201/GetData”

i think it should be url: “MyPage.aspx?id=201”

2) i have another question that what different type of value can be set for dataType property of jquery ajax call.

dataType can be html or text? when dataType would be html then what would be right contentType? and the same way when

dataType would be text then what would be right contentType?

3) when dataType will be text or html then can i call my custom server side function like url: “MyPage.aspx/GetData”,

4) when dataType will be text or html then how to return data from server side function. then can i write code like

when datatype is text then do i need to return like below one

[System.Web.Services.WebMethod]
public static string GetData()
{
    return "Hello";
}

[System.Web.Services.WebMethod]
public static string GetData()
{
    response.write("Hello");
}

when datatype is html then do i need to return like below one

[System.Web.Services.WebMethod]
public static string GetData()
{
    return "<div>Hello</div>";
}

[System.Web.Services.WebMethod]
public static string GetData()
{
  response.write("<div>Hello</div>");
}

do i need to set response.content type.

please guide in detail…….thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:44:10+00:00Added an answer on May 25, 2026 at 2:44 am

    The answers

    i doubt i am getting error because url is wrong url: “MyPage.aspx?id=201/GetData”

    Your ajax call should be like this

    type: "POST",
    url: "MyPage.aspx/GetData",
    data: "{}",
    

    You are calling GetData on MyPage.aspx. Why should you worry that it has querystrings and hashtags? So, please do not pass the querystring.

    what different type of value can be set for dataType property

    Have you read this once? http://api.jquery.com/jQuery.ajax/ Check the section dataTypes.

    Questions 3 and 4

    Why don’t you try and find that for yourself? Wont take more than 10 minutes.

    P.S: Don’t worry about the downvotes. The problem is that this question is a valid one at forums, but not here. Thats because, this is not exactly a forum, this is a QA site.
    Read: https://stackoverflow.com/faq#dontask

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C++, I code this way: //foo.h class cBar { void foobar(); } //foo.cpp
I've got a JavaScript object, built this way: function foo() { this.length = 0;
In my code I'd like to make my repositories IQueryable. This way, the criteria
I am validating a zip code using Javascript that is generated server-side, and injected
I'm working on a project with Node.js and the server-side code is becoming large
I often use webservice this way public void CallWebservice() { mywebservice web = new
Why was C# designed this way? As I understand it, an interface only describes
Actually, I'm using this way. Do you have a better way? private bool AcceptJson(HttpRequest
Without arguing the relative merits of storing a datetime this way... If you had
I have CSV data loaded into a multidimensional array. In this way each row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.