Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic jQuery ajax from a third party site
    primarykey
    data
    text
    <h3>Short Version</h3> <p>I am having trouble with the AJAX using jQuery.</p> <p>here's my <a href="http://fiddle.jshell.net/aBQud/5/" rel="nofollow">Fiddle</a> .. I keep getting <code>undefined</code> as the response back from the <code>get()</code>. How do I get that html from my query?</p> <h3>Long Version</h3> <p>At the moment this is just an idea. I found a site <a href="http://www.pin1yin1.com/" rel="nofollow">http://www.pin1yin1.com/</a> which accepts queries directly at the end of the url after the comment mark, like: <code>http://www.pin1yin1.com/#中文</code> — it returns a very good pinyin for a given hanzi.</p> <p>I am considering writing a google chrome extension that would automatically ruby-ify chinese text inline in the document, like many page translation tools.</p> <p>To do this, I have to interpret the results from that site. They always looks something like this:</p> <pre><code>&lt;tr class="characters"&gt; &lt;td&gt;&lt;a href="/dict/zi/中"&gt;中&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="/dict/zi/文"&gt;文&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="pinyin"&gt; &lt;td&gt;zhōng&lt;/td&gt; &lt;td&gt;wén&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>and I need to convert that to ruby that I could inject back into the page like:</p> <pre><code>&lt;ruby&gt;中 &lt;rt&gt;&lt;a href="/dict/zi/中"&gt;zhōng&lt;/a&gt;&lt;/rt&gt; &lt;/ruby&gt; &lt;ruby&gt;文 &lt;rt&gt;&lt;a href="/dict/zi/文"&gt;wén&lt;/a&gt;&lt;/rt&gt; &lt;/ruby&gt; </code></pre> <p>So my question is, how do I do that? I am having trouble with the AJAX using jQuery.</p> <p>here's my <a href="http://fiddle.jshell.net/aBQud/5/" rel="nofollow">Fiddle</a> .. I keep getting <code>undefined</code> as the response back from the <code>get()</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload