Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live-Server Ajax Call #40

Closed
jtang227 opened this issue May 23, 2015 · 1 comment
Closed

Live-Server Ajax Call #40

jtang227 opened this issue May 23, 2015 · 1 comment

Comments

@jtang227
Copy link

I am trying to get the json file and seems not working.

// js

$(function() {

    var $orders = $('#orders');

    $.ajax({
        type: 'GET',
        url: '/api/orders.json',
        success: function(orders) {
            $.each(orders, function(i, order) {
                $orders.append('<li>name: '+ order.name + ', drink: '+ order.drink +'</li>');
            });
        },
        error: function() {
            console.log('Error!');
        }
    });
});

// json

"orders":[
    {
        "id": 1,
        "name": "John",
        "drink": "Honey Green Tea"
    },
    {
        "id": 2,
        "name": "Will",
        "drink": "Taro Milk Tea"
    }
]
@harrytruong
Copy link
Contributor

@jtang227 I'm having trouble understanding your issue. Could you update to the latest version, and if the issue still exists, then re-submit with a cleaned up issue description? See Github Markdown docs for proper styling especially the fenced-code-blocks section.

My best guess is that your orders.json file is not located within an /api folder. Please check again?

@tapio tapio closed this as completed Oct 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants