View Full Version : problem getting JQuery $.getJSON to work

03 May 2010, 05:20 AM
the original question has been answered by one of my friends but I'm having another issue with requesting an XML document:
thanks for any help you can give me.
here is the html:

<div id="wrapper">
<a href="index.html"><img src="logo.png" class="logo" alt="Cookin' in Korea logo" /></a>
<div id="navigation">
<form name="searchbox">
<label id="search">Search</label>
<input type="text" id="searchText"/>
<li id="contact"><a href="#">Contact</a></li>
<div id="upcoming">
<h2><a href="#">Upcoming Recipes</a></h2>
<li class="preview" name="preview" id="Meatloaf"><a href="#">Meatloaf</a></li>
<li class="preview" name="preview" id="Pesto"><a href="#">Pesto</a></li>
<li class="preview" name="preview" id="Alfredo_Spaghetti"><a href="#">Alfredo Spaghetti</a></li>
<li class="preview" name="preview" id="Spring_Rolls"><a href="#">Spring Rolls</a></li>
<li class="preview" name="preview" id="Burrito"><a href="#">Burritos</a></li>
<li class="preview" name="preview" id="Sloppy_Joe"><a href="#">Sloppy Joe</a></li>
<div id="lower_menus">
<li class="menu" id="blog"><a href="#">Blog</a></li>
<li class="menu" id="recipes"><a href="#">Recipes</a></li>
<li class="menu" id="videos"><a href="#">Videos</a></li>
<li class="menu" id="aboutme"><a href="#">About</a></li>
<div id="clear"></div>
<div id="divider"></div>
<div id="content">
Copyright 2010 Raymond Cheung

here is the script:

$(document).ready(function() {
$('#Alfredo_Spaghetti').click(function() {
$.get('alfredo_spaghetti.xml', function(data) {
var entry=$(data).find("entry");
var html="<div class='recipe'>";
html+="<h3 class='name'>"+entry.attr("name")+"</h3>";
html+="<div class='description'>"
return false;
here is the XML contents

<?xml version="1.0" encoding="utf-8"?>
<entry name="Spaghetti_Alfredo">
<description>Alfredo Fettuccini is something that can nearly impossible to make in Korea if you insist on the original ingredients. The problem lies in fresh parmesan cheese and fettuccini. These are not easy nor cheap to come by here. You cannot use pre-grated parmesan cheese(like Kraft) as this will cause the sauce to separate as soon as it becomes cold. By the way, never say that Alfredo sauce is Italian to an Italian; it's Italian-American.</description>
<item>2 1/2 cups of milk"</item>
<item>6 cloves of garlic"</item>
<item>1 pound of spaghetti noodles</item>
<item>3 tablespoons of cooking oil</item>
<item>1 tablespoon of salt</item>
<item>1 head of broccoli</item>
<item>1/4 cups of butter</item>
<item>1/4 cups of cream</item>
<item>3 slices of white cheese slices</item>
<step1>Bring a pot of water to a boil, then add in rock salt, or table salt as an alternative. Then a tablespoon of oil to ensure that the noodles will not stick. Add the noodles whole, not broken. After 10 seconds the noodles will soften and you can bend them to push all of them into the boiling water. Then stir the noodles once every 5 minutes to make sure they cook evenly and don't stick.</step1>
<step2>While the noodles are boiling, cut some broccoli. Cut the stem off and rip off the heads of the broccoli whole as you work your way up the stem. Make sure to rip off the tiny leaves on the sides of the stem. Put them into boiling water for about 10 minutes. If you prefer soft broccoli, leave it in for another 5 minutes.</step2>
<step3>Next, for the sauce, heat up a sauce pan. Add two tablespoons of cooking oil and 6 cloves of garlic. Once the garlic is browned on one side, start stirring it to brown both sides as best you can. After, add 1/4 of a cup of butter/margarine. Once that is melted, lower the heat to a low setting. Add in 1/4 of a cup of cream and 2 1/2 cups of milk. If you are cooking for a Korean, then they probably cannot handle the heaviness of the cream, in which case you just use milk. Then add in 4 slices of the white cheese.</step3>
<step4>You want to set it to a low setting because it will burn at this stage if you don't. You want to slowly stir it as all the ingredients melt together. After about 15 minutes it should be ready, but this varies depending on the stove burner and type of pan. You want the sauce to be a bit light because as soon as it cools down to an edible temperature it will continue to thicken, so you have to account for this.</step4>
<substitutes>The substitutes I recommend still maintain a great base taste to which you can add your own extras like roasted garlic, roasted chicken, or anything else with a strong flavor to add. I used spaghetti in this recipe although you can still use fettuccini or any other long Italian noodles though I strongly recommend against angel hair noodles. You can use many other types of extras in this dish like ground beef, steak, or even boneless fish fillet. Experiment, as learning to cook is a trial and error process.</substitutes></entry>