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 8301049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:47:50+00:00 2026-06-08T16:47:50+00:00

i need to generate a json data on a button click but i am

  • 0

i need to generate a json data on a button click but i am unable to get the json
my shopping cart demo link
http://jsfiddle.net/bkw5p/48/

  • 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-06-08T16:47:51+00:00Added an answer on June 8, 2026 at 4:47 pm

    At the end of HTML, between <p class="total"> and <h2>:

    <input type="submit" id="submit" value="Make an order" />
    

    In JS inside the $(function() { ... }):

    $('#submit').bind('click',function(){
        if (!$('table#cartcontent1 tr').length) {
            alert('You have no Items in Your Cart');
        } else {
    
            var result = new Array();
            var name, qty, price;
            $('table#cartcontent1 tr').each(function(){
                name = $(this).find('td[data-bind="text:name"]').text();
                qty = $(this).find('input[data-bind="value:qty"]').val();
                price = $(this).find('td[data-bind="text:price"]').text();
                result.push( {'name' : name, 'qty' : qty, 'price' : price } );
            })
    
            $.ajax({
                type:"POST",
                url: 'ordering.php',
                data: {data: result},
                success: function(msg){
                    // do something when success
                }
            });
        }
        return false;
    })
    

    In PHP it will be like:

    $data = $_POST['data'];
    foreach ($data as $val) {
        echo $val['name']; // Feeling
        echo $val['price']; // 25
        echo $val['qty']; // 3
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when I navigate to http://localhost:54763/Colorbox/Service.svc/GetCustomers , I get the json data displayed.. but this
I need to generate java class definition from json data. Is there any tool
I need help for generate the series data part into json var chart =
I need to pre-compress some very large html/xml/json files (large data dumps) using either
I'm dealing with data input in the form of json documents. These documents need
I am able to send data to the server using JSON and get back
I need to generate json from the serverside, which I know how to do.
I need to generate checkbox group based on data from DB, so I fetch
here i attach a sample code. they used JavaScriptSerializer to generate data in json
I need to build a java based JSON data API that will be accessed

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.