0

I created a simple static web project in Eclipse. I downloaded jquery.js and jquery.dataTables.js into my WebContent folder. Then I created a index.html page which looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.dataTables.js"></script>

<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('#example').dataTable({
            "sAjaxSource" : 'http://localhost:8080/myProj/listLogs?messageId=33333333333'
        });
    });
</script>


<title>Insert title here</title>
</head>
<body>

    <table cellpadding="0" cellspacing="0" border="0" class="display"
        id="example">
        <thead>
            <tr>
                <th>stuff</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
        <tfoot>
            <tr>
                <th>stuff</th>
            </tr>
        </tfoot>
    </table>

</body>
</html>

The JSON response from http://localhost:8080/myProj/listLogs?messageId=33333333333 should look like:

{

"aaData": [
    [
        "This is a NEW message"
    ],
    [
        "Parsing message with messageId = 33333333333 and eventType = CREATE"
    ],
    [
        "Start running workflow with 4 actions"
    ],
    [
        "Updating entitlement for event: [33333333333:CREATE]"
    ],

... }

But when I open the index.html in my firefox, nothing gets loaded. I do see this on the page though:

stuff
stuff
Loading...
Showing 0 to 0 of 0 entries
PreviousNext

My JSON URL was not even invoked. Not sure why.

8
  • validate your json using JSONLint.com it is not valid Commented Feb 9, 2012 at 5:29
  • Just did. It is valid. As I said, the URL is not even invoked. I can tell by monitoring on the server side. Commented Feb 9, 2012 at 5:34
  • i will advise you to please have a look in the firebug console or XHR request from XHR tab under net panel of firefox to see if your URL invocation caused some error like 500 internal server error or 404 error that will help you and also check if the pat is correct Commented Feb 9, 2012 at 5:37
  • On a side note, with jQuery you no longer need $(document).ready(function() {. Just simplly enclose onload code in: $(function(){ //code goes here }); Commented Feb 9, 2012 at 5:45
  • firebug console says: GET localhost:8080/myProj/… 200 OK x 254ms. Hum...seems that the URL did get invoked correctly. Still nothing shows up on the page. Commented Feb 9, 2012 at 5:55

1 Answer 1

0

Think I found the answer:

http://en.wikipedia.org/wiki/Cross-Origin_Resource_Sharing

My JSON endpoint is on a different port :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.