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

  • SEARCH
  • Home
  • 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 7091025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:07:50+00:00 2026-05-28T08:07:50+00:00

I am trying to make an ajax json callback using a .net application. So

  • 0

I am trying to make an ajax json callback using a .net application. So i make a jquery ajax call and i want the data to be sent back in json format. This is what i have done so far.

The requiest is working but the response isnt working.

JQUERY AJAX


function Ajax_Callback(param,callback) {

$.ajax({
    url: "default.aspx?param=" + param,
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    success: function(data) {
        if (callback) {
            callback.call(null, data);
        }
    }
});

}

.NET APPLICATION for callback


Private Sub BaseControls_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Me.Page.Request.Headers.Item("X-Requested-With") = "XMLHttpRequest" Then

            Me.Page.Response.Clear()
            Me.Page.Response.ContentType = "application/json"
            Me.Page.Response.Write(Me._GetHTMLServerResponseCallback)
            Me.Page.Response.Flush()
            Me.Page.Response.End()

        End If


    End Sub

Private Sub Main_RaiseCallbackReference(ByVal pageType As BaseControls.PageEnumType, ByVal data() As String) Handles Me.RaiseCallbackReference

        Select Case pageType

            Case PageEnumType.Main


                Dim request As String = data(0)

                If request = "ThreadCreated" Then

                    Dim idThread As Integer = CInt(data(1))

                    Dim sb As New StringBuilder()
                    Dim sw As New StringWriter(sb)
                    Dim htw As New HtmlTextWriter(sw)

                    Dim userThreadControl As New UI.UserThreadControl(idThread)
                    Me.Controls.Add(userThreadControl)

                    userThreadControl.RenderControl(htw)

                    Dim html As String = sb.ToString

                    Me._GetHTMLServerResponseCallback = "[ { title: 'One', key: '1' }, { title: 'Two', key: '2' } ]"

                End If


        End Select

    End Sub
  • 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-28T08:07:50+00:00Added an answer on May 28, 2026 at 8:07 am

    It was the JSON format which i was sending back in wrong format, instead of using ‘ i used “. The double quotes fixed the format and the response now occurs. Kevin B pointed out a JSON Validator, when i tested the JSON with single quotes i got errors but when using double quotes the error were no longer occurring. Thanks

    Private Sub Main_RaiseCallbackReference(ByVal pageType As BaseControls.PageEnumType, ByVal data() As String) Handles Me.RaiseCallbackReference
    
            Select Case pageType
    
                Case PageEnumType.Main
    
    
                    Dim request As String = data(0)
    
                    If request = "ThreadCreated" Then
    
                        Dim idThread As Integer = CInt(data(1))
    
                        Dim sb As New StringBuilder()
                        Dim sw As New StringWriter(sb)
                        Dim htw As New HtmlTextWriter(sw)
    
                        Dim userThreadControl As New UI.UserThreadControl(idThread)
                        Me.Controls.Add(userThreadControl)
    
                        userThreadControl.RenderControl(htw)
    
                        Dim html As String = sb.ToString
    
                        Me._GetHTMLServerResponseCallback = "{ ""data"": ""<div></div>"",""threadID"": 6 }"
    
                    End If
    
    
            End Select
    
        End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to make my first AJAX with JSON call using jQuery and CodeIgniter.
I'm trying to make an ajax call to grab session data to insert into
I am trying to make two ajax requests in parallel using jQuery like this:
I aam trying to GET an array from a JSON file using JQuery's ajax
I'm trying to make a call to the server with Ajax using Grails remoteLink.
I'm trying to make a datatable using YUI with JSON returned data. Included is
i am trying to make AJAX Call to ASP.Net Server Side Web service method
I'm trying to make a jQuery .ajax() call to a public web service, and
i'm trying to make my image search with google ajax search i'm using jQuery.
I am trying to make use of jQueryUI AJAX tabs in my ASP.Net Webforms

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.