Jaydata and Odata- HTTP Request Failed
I have my own custom server to expose data from an XML file. I can browse
through it in whichever browser of my choosing and I can query the data in
Fiddler, but Jaydata (or one of its building blocks) can't seem to grab
the same data. What's most frustrating is that my code is (or was, I've
tweaked it slightly to try and resolve these errors) pretty much an exact
duplicate of code found here and here. Here's my script:
<script type="text/javascript" src="/Scripts/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/Scripts/datajs-1.0.3.js"></script>
<script type="text/javascript" src="/Scripts/jaydata.js"></script>
<script type="text/javascript"
src="/Scripts/jaydataproviders/oDataProvider.js"></script>
<script type="text/javascript" src="/Scripts/Block.js"></script>
<script type="text/javascript">
var Context = new foo({
name: 'oData',
oDataServiceHost: 'http://localhost:xxx'
});
function createItemLI(user, id, css) {
var li = "<li></li>".append(name).addClass(css).data('id', id);
return li;
}
$.when($.ready, Context.onReady()).then(function () {
Context.Roots.toArray(function (roots) {
roots.forEach(function (root) {
$('#roots').append(
createItemLI(root.User, root.ID, 'root'));
});
});
});
</script>
Block.js, is the file generated by JaySvcUtil.exe There's only one thing
in the body of the .htm file, a simple <ul id="roots"></ul>
When I try to run the project, there's nothing on the page. When I used
FireBug, I get "HTTP request failed" The requestUri is
http://localhost:xxx/Roots, which works when I manually browse to it, but
the StatusCode is 0, statusText is the empty string, and so on and so
forth. I've looked at Fiddler, at it gets exactly what I expected.
I'm assuming there's some manner of flag that needs to be set, but none of
the tutorials I've found have been of any help. It's assumed that it works
out of the box, and I too had high expectations getting simple read access
would be easy.
No comments:
Post a Comment