Display the JSON response received using AJAX

Cody

I am having some problem to displaying the response getting from the below given code. Please help me to display the response on my page that I am getting from this code:

$(document).ready(function () {
    console.log("ready!");
    $('#m_p_advc').change(function () {
        var sup = $('#m_p_advc').val();
        $('#result').html(sup);
        $.ajax({
            type: 'GET',
            url: '../hcshimla/newfiling/ajaxfunction.php',
            data: {gadvcd: sup, flag: 'ADV'},
            success: function (response) {
                $('#result').html(response.first);
            }
        });
    });
});

And here is the screenshot of data that I am receiving through this code:

Screenshot of the response I am getting

In this response (data) I want to split every bit of information seperating with "~" (sign) and display them on different textboxes on the form.

Lokesh_Ram

With your response you got,split them with ~ and if you want to display the splitted values on different textboxes means loop them inorder to place the value with the respective text boxes.. Here is the sample code for that.. Not sure whether your looking for this kind of an output..

Sample Html:

<input type="text" id="TextBox0"  />
<input type="text" id="TextBox1"  />
<input type="text" id="TextBox2"  />

jQuery:

$(document).ready(function () {
    $.ajax({
        type: 'GET',
        url: '../hcshimla/newfiling/ajaxfunction.php',
        data: {gadvcd: sup, flag: 'ADV'},
        success: function (response) {

            var arr = response.split("~");

            for (var i = 0; i <= arr.length; i++)
            {
                $('#TextBox' + i + '').val(arr[i]);
            }
        },
        error: function (response) {
            alert(response);
        }
    });
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

JSON response received in AJAX success but not parsing

From Dev

Ajax response using json

From Dev

Display the ajax response button id using jquery

From Dev

Display the ajax response button id using jquery

From Dev

Display content of JSON response using Knockout

From Dev

Display json response in grid using angular js

From Dev

Display content of JSON response using Knockout

From Dev

Ajax : empty json response when using Karma

From Dev

Using variable from ajax response as json

From Dev

Setting Ajax response to drop down using json

From Dev

Using ajax json response in an angular scope variable

From Dev

Ajax POST - display response

From Dev

submit html form with AJAX and display json response from external api

From Dev

Display JSON data from url using ajax

From Dev

How to upload an image on a server using authorization and show the received json response in Android?

From Dev

Splitting a string received from Json response

From Dev

Parsing JSON data received in blogger api response

From Dev

Cannot Parse a JSON response that is received by RestTemplate

From Dev

Splitting a string received from Json response

From Dev

Convert a received JSON response to List<T> in Java

From Dev

Display the JSON response

From Dev

How to display my JSON response in a table using Laravel?

From Dev

Display Image in ajax response in a table

From Dev

Json response to ajax

From Dev

symfony Response with json ajax

From Dev

Ajax JSON response not working

From Dev

AJAX: Invalid JSON response

From Dev

AJAX search and JSON response

From Dev

Ajax JSON response into HighCharts