(taking a deeper look)

Your response is HTML. You can drop the whole JSON stuff and use $
("#portfolio_quotes_div_block").html(data) in the callback directly,
no need to parse anything.

This is simple AJAX (or AHAH as some would call it), I think you mixed
up ajax/json/jsonp.

On Mar 31, 12:45 pm, Ricardo <ricardob...@gmail.com> wrote:
> You are trying to parse the response as JSON, but it looks like XML.
> JSON is JavaScript Object Notation (http://www.json.org/js.html).
>
> cheers,
> - ricardo
>
> On Mar 30, 4:08 pm, ckoeber <ckoe...@gmail.com> wrote:
>
> > Hello,
>
> > I am trying to create a JSON service and everything seems to work well until
> > I am pulling the actual data from gthe service to be inserted into a DIV
> > element on a page.
>
> > Here is the code for the JSON service (client side):
>
> >                 &nbsp;if (Drupal.jsEnabled) {
>
> >             &nbsp;&nbsp; &nbsp;$(document).ready(
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;function(){
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp;
> > &nbsp;$(&quot;#portfolio_quotes_div_form_block&quot;).html('&lt;form
> > id=&quot;frmPortfolioSymbolsBlock&quot;
> > name=&quot;frmPortfolioAddSymbolBlock&quot; method=&quot;post&quot;
> > action=&quot;&quot;&gt;&lt;label&gt;Symbol&lt;input
> > name=&quot;txtSymbol&quot; type=&quot;text&quot; id=&quot;txtSymbol&quot;
> > size=&quot;10&quot; /&gt;&lt;/label&gt;&lt;label&gt;&lt;input
> > type=&quot;submit&quot; name=&quot;cmdAdd&quot; id=&quot;cmdAdd&quot;
> > value=&quot;Add&quot; /&gt;&lt;/label&gt;&lt;label&gt;&lt;input
> > type=&quot;submit&quot; name=&quot;cmdReloadSymbols&quot;
> > id=&quot;cmdReloadSymbols&quot; value=&quot;Refresh&quot;
> > /&gt;&lt;/label&gt;&lt;/form&gt;');
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;//Drupal.settings.portfolio_json_getquotes.uid
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;$.post(Drupal.settings.portfolio_json_getquotes.ajaxUrl,{uid:Drupal.settings.portfolio_json_getquotes.uid},
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > function (data) {
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var
> > result = Drupal.parseJson(data);
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > $(&quot;#portfolio_quotes_div_block&quot;).html(result);
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>
> > });
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp;
> > &nbsp;$(&quot;#cmdReloadSymbols&quot;).bind(&quot;click&quot;, function() {
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > $.post(Drupal.settings.portfolio_json_getquotes.ajaxUrl,{uid:Drupal.settings.portfolio_json_getquotes.uid},
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > function (data) {
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; var
> > result = Drupal.parseJson(data);
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > $(&quot;#portfolio_quotes_div_block&quot;).html(result);
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>
> > });
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; return false;
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
> > &nbsp;&nbsp;&nbsp; &nbsp;});
>
> >             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
>
> >             &nbsp;&nbsp; &nbsp;)
>
> >             }
>
> > &nbsp;And here is a sample of the data returned from the working service
> > (the code below is formatted for js):
>
> > &quot;\x3ctable id=\&quot;portfolio_quotes_table_block\&quot;
> > width=\&quot;100%\&quot; border=\&quot;0\&quot; cellspacing=\&quot;0\&quot;
> > cellpadding
> > =\&quot;0\&quot;\x3e\x3ctr\x3e\x3cth
> > scope=\&quot;col\&quot;\x3eSymbol\x3c/th\x3e\x3cth
> > scope=\&quot;col\&quot;\x3eLast\x3c/th\x3e
> > \x3cth
> > scope=\&quot;col\&quot;\x3eChange\x3c/th\x3e\x3c/tr\x3e\x3ctr\x3e\x3cth
> > scope=\&quot;row\&quot;\x3eMSFT\x3c/th\x3e
> > \x3ctd\x3e17.44\x3c/td\x3e\x3ctd\x3e-0.69\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3cth
> > scope=\&quot;row\&quot;\x3e\x3c
> > /th\x3e\x3ctd\x3e\x3c/td\x3e\x3ctd\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e&quot;
>
> > &nbsp;Essentially what I am looking for is a table that will be inserted
> > inside a DIV element on the first loading of a page as well as when the
> > refresh button on the form by the JS code above. The code runs but I get the
> > following message:
>
> >                 uncaught exception: Node cannot be inserted at the specified
> > point in the hierarchy (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)
>
> > Any ideas?
>
> > Thank you for your time.
>
> > Regards,
>
> > Christopher Koeber
>
> > &nbsp;
>
> > --
> > View this message in 
> > context:http://www.nabble.com/Jquery---Weird-Issue-with-%22Node-cannot-be-ins...
> > Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to