You were right; it's not returning nothing (that is to say, it is
returning something). And, as a matter of fact, now that I have taken
the time to look at the contents of the 'step1' variable after
the line shown is executed, it apparently succeeded. Firebug shows these properties:
step1.readyState is 4;
step1.responseText contains all the data from the specified list item
(plus a bunch of stuff);
step1.status is 200; and
step1.statusText is "OK".
BUT, the inline call back function is not getting executed, so nothing
is getting written to my SharePoint form page -- that is why I thought
nothing was being returned. My mistake.
Soooo, the correct question is why is the callback function not being
executed? Stepping through the code, if I step over the $.getJSON call,
the next line executed is the last line of the inline callback function.
It doesn't go into the callback at all.
That is not the behavior I see, when I request the entire list, rather
than a single list item. Execution happily goes into the callback, when
the entire list is returned.
IE says that there is an error executing Line 3 Char: 5099 of
jquery-1.9.1.min.js -- 'length' is null or not an object. Using
Firebug to look at the code, it appears that the line is in this code:
-
each: function (e, t, n)
{
var
r,
i =
0,
o =
e.length,
a =
M(e);
if (n)
{
if (a)
{
for (; o > i; i++) if (r = t.apply(e[i], n), r === !1)
break
} else for (i in e) if (r = t.apply(e[i], n), r === !1)
break
} else if (a)
{
for (; o > i; i++) if (r = t.call(e[i], i, e[i]), r === !1)
break
} else for (i in e) if (r = t.call(e[i], i, e[i]), r === !1)
break;
return e
},
And it's the o = e.length line that IE complains about.
My code there is:
- /*
Function to display the fields for the selected product
*/
function WriteProductFields()
{
var myURL =
"https://thesite/this/that/_vti_bin/ListData.svc/TheList("
+ productId + ")";
step1 = $.getJSON(myURL,function(data) {
$.each(data.d.results,
function(i,result) {
var src =
result.__metadata.media_src;
/* First, grab values to be
stored for later use */
productLine = result.PL;
data1
=
result.DATA1;
data2 =
result.DATA2; ...
Again, virtually identical code WORKS, if I simply omit the
(productId) from the URL. There is an extra 'if' statement, to
filter out all list items but the one with the selected productId.
Is this enough information to identify what I am doing wrong?
All assistance is still very welcome... especially since there are
such glaring gaps in my understanding (obviously).
Thank you!