You must Sign In to post a response.
  • Category: JQuery

    Read the Json formatted data using Jquery & Ajax


    while loading the page i want to get the price and item counts in ASP.Net project.

    Here I want to validate the price with their counts which was generated in Json format in Jquery. The Json formatted output will be generated from solr query(refer the attached image). Here i want to read the price and get the number of items available within that price using Jquery and AJAX with Could anyone let me know the way of process to get it.

    Solr Query is:
    http://localhost:8080/solr/ABC/select?q=*:*&wt=json&indent=on&rows=0 & facet=true&facet.range=price & f.price.facet.range.start=0 & f.price.facet.range.end=500 & & facet.range.other=after

    After generated the above URL in ASP.Net project the result would be like an attached image.
  • #768714
    Hi Gopi,
    Looks like you're getting JSONP and not a JSON object. For more info for JSONP refer to this:

    However, you can solve the issue (you're facing) by parsing, I am giving you a json example here (as you said it is json, however in my believe it is JSONP):

    var jObj = jQuery.parseJSON( 'jData' );
    alert( jObj.Price); //it will give you complete

    In preceding snippet, you'd get complete 'Price' object and now you can apply conditions here. For any further discussion, let me know.

    Thanks & regards,
    Gaurav Kumar Arora
    Site Coordinator - DNS
    My blog -

  • #768720
    Hi Gaurav,

    Yes, you are correct. Mine is JsonP. i am fresh for the Json format. I could not start from your coding. could you please share some piece of coding to get it from solr URL.

  • #768748

    Hi Gopi,

    Sorry for delay in response.
    Try this fiddle:

    Hope, this solution helps you.

    Thanks & regards,
    Gaurav Kumar Arora
    Site Coordinator - DNS
    My blog -

  • #768791
    You can use given code snippet as example for validate the price with their counts using Jquery & Ajax
    <div class="products">
    <input type="checkbox" data-price="100" value="1" name="product_ids[]" id="product_id_1">

    <div class="payment_options">
    <input type="radio" data-price-modifier="1.0" value="1" name="payment_option_id" id="payment_option_id_1">

    <div id="final_price"></div>

    Useful Reference:

  • Sign In to post your comments