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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:50:22+00:00 2026-05-24T17:50:22+00:00

I wrote a small html/js as shown below: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0

  • 0

I wrote a small html/js as shown below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link type="text/css" rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" />
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.min.js"></script>
    <script type="text/javascript" src="datajs-1.0.1.min.js"></script>
    <script type="text/javascript" src="json2.js"></script>
    <script type="text/javascript" src="jquery.tmpl.js"></script>
    <script type="text/javascript" src="DataJSCRUD.js"></script>
</head>
<body>
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    OData Javascript Consumer
                </h1>
            </div>
            <div class="clear hideSkiplink">
            </div>
        </div>
        <div class="main">
            <div id="customers-contain" class="ui-widget">
                <h1>
                    Customers:</h1>
                <table id="customers" class="ui-widget ui-widget-content">
                    <tr class="ui-widget-header ">
                        <th>
                            CustomerID
                        </th>
                        <th>
                            CompanyName
                        </th>
                        <th>
                            ContactTitle
                        </th>
                        <th>
                            Address
                        </th>
                        <th>
                            City
                        </th>
                    </tr>
                </table>
                <span id="loadingCustomers" style="display: none">Loading...</span>
            </div>
        </div>
        <div class="clear">
        </div>
        <div class="footer">
        </div>
    </div>
    <script type="text/javascript">
        $(OnPageLoad)
    </script>
</body>
</html>

DataJSCRUD.js

/// <reference path="jquery-1.4.1-vsdoc.js" />

//ODATA Root Service URI
var CUSTOMERS_ODATA_SVC = "http://services.odata.org/Northwind/Northwind.svc/Customers";

//Page Load Actions

function OnPageLoad() 
{
    GetCustomers();
} 

//Page Events:
//***********************Get Customers (READ)***************************
//Gets all the Customers from service
function GetCustomers() 
{
    $("#loadingCustomers").show();
    alert("ok");
    OData.read(CUSTOMERS_ODATA_SVC, GetCustomersCallback);
}

//GetCustomers Success Callback
function GetCustomersCallback(data, request) 
{
    $("#loadingCustomers").hide();
    $("#customers").find("tr:gt(0)").remove();
    ApplyTemplate(data.results)
}



//*************************Helper Functions***************************

//Helper function to apply UI template
function ApplyTemplate(data) 
{
    var template = "<tr id=\"customerRow${CustomerID}\">" +
                            "<td>${CustomerID}</td>" +
                            "<td>${CompanyName}</td>" +
                            "<td>${ContactTitle}</td>" +
                            "<td>${Address}</td>" +
                            "<td>${City}</td>" +
                        "</tr>";

        $.tmpl(template, data).appendTo("#customers tbody");
}

Could not understand what went wrong here.

  • 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-24T17:50:23+00:00Added an answer on May 24, 2026 at 5:50 pm

    Got it. Have to add the following line:

    OData.defaultHttpClient.enableJsonpCallback = true;
    

    Hopefully, this would help others.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I quickly wrote this up, http://www.ionfish.org/php-shrink/ where a user uploads a .php file with
I wrote a small .NET applications that removes all line breaks in aspx/html/css code
According to the link below, I wrote a small test case. But it doesn't
So, I wrote a small page: <html> <head> <script type=text/javascript src=jquery.js></script> <script> function slide()
I wrote a small jquery plugin that basically converts all words in an html
Can anyone please tell me how to write a small div container in HTML
I wrote a small PHP application several months ago that uses the WordPress XMLRPC
I wrote a small PHP application that I'd like to distribute. I'm looking for
We wrote a small Windows class library that implements extension methods for some standard
I wrote a small sample of code in C# to capture selected text from

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.