Question

I need some JQuery code to pull a JSON object as a result to a search query.

Asked by: Teamsite_Noob

Basically, we are implementing a search box on our website with a Set of Straight SQL Queries, that return the result as a JSON Object. Now I need to retrieve that JSON object and write it to a table that shows the search results. I have been trying to do it with plain JavaScript, but I am told JSOn is the way to...the javascript I have is in a function called "DOIT". Here is what I have so far

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/prospect.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Prospect - Medi-CareFirst</title>
<!-- InstanceEndEditable -->
<link href="../includes/styles.css" rel="stylesheet" type="text/css" media="screen" />
<link href="../includes/styles-lowGraphic.css" rel="alternate stylesheet" type="text/css" media="screen" title="lowGraphic" />
<!--[if IE 6]><link href="../includes/ie6.css" rel="stylesheet" type="text/css" media="screen" /><![endif]-->
<!--[if gt IE 6]><link href="../includes/ie.css" rel="stylesheet" type="text/css" media="screen" /><![endif]-->
<link href="../includes/print.css" rel="stylesheet" type="text/css" media="print" />
<meta http-equiv="imagetoolbar" content="no" />
<script type="text/javascript" src="../includes/functions.js"></script>
<script type="text/javascript" src="../includes/jquery.js"></script>
<script type="text/javascript" src="../includes/tabs.js"></script>
<script type="text/javascript" src="../includes/fancybox/fancybox.js"></script>
<script type="text/javascript" src="../includes/qtip.js"></script>
<link href="../includes/fancybox/fancybox.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() { 
	$("a.fancylink").fancybox({
		'overlayShow':		true,
		'overlayOpacity':	.4,
		'padding': 			0,
		'frameWidth':		616,
		'frameHeight':		289
	});
	
	 $('#content a.tooltip[href][title]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
	  style: { 
		width: 300,		padding: 10,		background: '#FFFFFF',		color: '#333333',		textAlign: 'left',		fontSize: '1.2em', 
		border: {
			width: 2,			radius: 3,			color: '#204890'
		},
	  tip: 'leftMiddle',
	  name: 'dark' // Inherit the rest of the attributes from the preset dark style
	  },
	  position: {
		corner: {
			target: 'rightMiddle',
			tooltip: 'leftMiddle'
		}
	  }
   });
   // Prevents page jumping on tooltip links that don't go anywhere
   $('#content a.tooltip[href="#"]').click( function(){ return false });
	
	// Re-applies transparent PNG fix for IE6 when coming back to the graphics version
	$('a.regStyles').click( function(){
		// Test for IE6
		if((!window.XMLHttpRequest)){
			$('#rightColumn img.calendarImg').addClass('pngFix');
		}
	});
});
</script>
 
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript">
 
function doIT(){
	var temp=new XMLHttpRequest("GET","http://dveweb3.carefirst.com/meddinfo/drug/findDrugController.json?by=name&year=2009&drugNamePattern=ab");   
	temp.onreadystatechange=function()
	{
	 
	if (this.readyState==4) 
	{
	 
	   eval("var retrievedData="+this.responseText);  
	 
	   var content=document.getElementById("MYJSON")  
	   for (var i=0;i<retrievedData.data.length;i++){
		   var element = document.createElement('div');   // create new element
		   element.innerHTML = "Title: "+retrievedData.data[i].title+", Text"+retrievedData.data[i].text;  
		   content.appendChild(element);     
	   }
	 
	}
	 
	}
	temp.send(null);  // now execute
}
</script>
 
<!-- InstanceEndEditable -->
</head>
 
<body class="interior">
	<div id="page">
        <div id="header">
            <div id="logo"><a href="../index.html"><img src="../images/common/logo.jpg" alt="Medi-Carefirst BlueCross BlueShield" /><span>Medi-CareFirst BlueCross BlueShield</span></a></div><!-- end logo  -->
            <ul id="utilityNav">
                <li><a href="../mcf/index.html">Home</a></li>
                <li><a href="../html/AboutUs.html">About Us</a></li>
                <li><a href="../html/Glossary.html">Glossary</a></li>
                <li><a href="../html/ContactUs.html">Contact Us</a></li>
                <li><a href="../html/AccessibilityHelp.html">Accessibility Help</a></li>
                <li class="last"><a href="#">Search</a></li>
                <li class="last" id="formLi">
                    <form action="" method="get" id="searchForm">
                        <input class="searchInput" name="" type="text" size="15" />
                        <input name="" class="go" type="image" src="../images/common/btn_go.gif" />
                    </form>
                </li>
            </ul><!-- end utilityNav  -->
        </div><!--  end header  -->
        <div id="mainNav">
            <ul>
                <li class="active"><div><a href="../html/index.html"><span>Members &amp; Visitors</span></a></div></li>
                <li><div><a href="../caregivers/index.html"><span>Caregivers</span></a></div></li>
                <li><div><a href="../providers/index.html"><span>Providers &amp; Physicians</span></a></div></li>
            </ul>
        </div><!--  end mainNav  -->
        <div id="welcomeBar">
        	<p>Welcome to Medi-Carefirst.com!</p>
            <ul>
            	<li class="textLi"><a href="#" class="textStyles" onclick="setActiveStyleSheet('lowGraphic'); return false;">Text Only</a></li>
                <li class="regLi"><a href="#" class="regStyles" onclick="setActiveStyleSheet('default'); return false;">Back to Graphics Version</a></li>
                <li class="last">
                  Change text size: 
        		  <a href="#" onclick="ts('body',0)" class="small" title="Small Fonts">A</a>
		          <a href="#" onclick="ts('body',1)" class="medium" title="Medium Fonts">A</a> 
            	  <a href="#" onclick="ts('body',2)" class="large" title="Large Fonts">A</a>
                </li>
            </ul>            
        </div><!--  end welcomeBar  -->
        <div id="content">
                  <div id="leftColumn"><!-- InstanceBeginEditable name="navigation" -->
                  	<div class="secondaryNav">
                   		<ul class="numberNav">
                        	<li class="first parent"><a href="index.html" class="item1"><span>Learn About Medicare</span></a></li>
                            <li class=" "><a href="ChoosingAPlan.html" class="item2"><span>See Plans We Offer</span></a></li>
                            <li class="parent parentActive"><a href="ReviewPlanPartD.html" class="item3"><span>Review Plan Details</span></a></li>
                            	<ul class="terNav">
                                	<li><a href="CostAndBenefits.html"><span>What are the Costs &amp; Benefits?</span></a></li>
                                    <li class="active"><a href="AreMyDrugsCovered.html"><span>Are my Drugs Covered?</span></a></li>
                                    <li><a href="DoesMyPharmacyParticipate.html"><span>Does my Pharmacy Participate?</span></a></li>
 
                                </ul>
                            <li class="last "><a href="SignUpNow.html" class="item4"><span>Sign Up</span></a></li>
                        </ul>
                    </div><!-- InstanceEndEditable --><!--  end secondaryNav  -->
                    
                    <div class="planQuestions">
                    	<div class="top">
                            <h3>Have questions about our plans?</h3>
                            <a href="QuestionsAboutPlans.html" class="arrowLink" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Click here</a>
                        </div>
                    </div><!--  end planQuestions  -->
    
                  </div><!--  end leftColumn  -->
 
                  <div id="centerColumn" class="box">
                 	<div class="top"><div class="left"><div class="right"><div class="tl"><div class="tr"><div class="bl"><div class="br">
					
					<!-- InstanceBeginEditable name="content" -->
                    
                   	  <h1>Im new to Medicare &gt; Learn About Medicare</h1>
                        
                        <div class="content">
                        	<div class="print">
	                        	<a href="#">Print</a>
                            </div>
                            
<h2>Are my Drugs Covered</h2>
<p>Unlike some plans, Medi-CareFirst&rsquo;s Blue Rx plans cover all Medicare Part D-approved drugs that are not available over-the-counter. The exact amount you will pay depends on which plan you choose and the type of drugs you purchase.</p>
 
          <div id="MYJSON">
          </div>
 
 
          <table class="dataTable" cellspacing="1" cellpadding="5" width="95%" border="0">
 
            <tbody>
              <tr>
                <th colspan="1" valign="top" nowrap="nowrap"><span class="lg">Search by Drug Name:</span><br /><br />
 
<form id="searchForm" method="post" acton="" ">
	<input name="queryfield" type="text" maxlength=75 class="searchInput">
	<input name="" class="go" type="image" src="http://www.medi-carefirst.com/mcf/images/interior/btn_go.gif" onClick="doIT();" >
</form>
 
 
 
</th>
        <th class="LeftLineWhite" valign="top" ><span class="sm">Other Search Options:</span><br />
<a href="/ecommerce/formulary2009.nsf/vwWebByCategory?OpenView">Category and Class</a><br />
<a href="/ecommerce/formulary2009.nsf/vwWebByCategoryPA?OpenView">Prior Authorization Needed</a><br />
<a href="/ecommerce/formulary2009.nsf/vwWebByCategoryQL?OpenView">Quantity Limits </a>
 
</th>
              </tr>
              <tr>
                <td  colspan="3"><strong>How a 4-Tier Drug Plan Works:</strong><br />
 
For pricing, drugs are divided into the following four tiers:</td>
              </tr>
              <tr>
                <td nowrap="nowrap"><a href="http://www.medi-carefirst.com/mcf/includes/incTierDrugPlan.htm" onclick="window.open(this.href,this.target,'scrollbars=yes,width=600,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank" ><b>Tier 1 ($)</b></a></td>
 
                <td >Generic drugs</td>
              </tr>
              <tr>
 
				<td><a href="http://www.medi-carefirst.com/mcf/includes/incTierDrugPlan.htm" onclick="window.open(this.href,this.target,'scrollbars=yes,width=600,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank" ><b>Tier 2 ($$)</b></a></td>
                <td scope="col" align="left">Preferred Brand-Name drugs</td>
              </tr>
                    <tr>
<td nowrap="nowrap"><a href="http://www.medi-carefirst.com/mcf/includes/incTierDrugPlan.htm" onclick="window.open(this.href,this.target,'scrollbars=yes,width=600,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank" ><b>Tier 3 ($$$)</b></a></td>
                <td scope="col" align="left">Non-Preferred Brand-Name drugs</td>
              </tr>
              <tr>
 
<td nowrap="nowrap"><a href="http://www.medi-carefirst.com/mcf/includes/incTierDrugPlan.htm" onclick="window.open(this.href,this.target,'scrollbars=yes,width=600,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank" ><b>Tier 4 (25% coinsurance)</b></a></td>
                <td  scope="col" align="left" colspan="2">
 
Non-Self-Administered-Medical Injectables (can be a Brand-Name or Generic drug)</td>
              </tr>
              
               
            </tbody>
          </table>
 
          <h3>Brand-Name and Generic Drugs</h3>
 
<p>Blue Rx plans cover both Brand-Name and Generic drugs. Generic drugs:</p>
 
<ul>
    <li>>Usually cost less than Brand-Name drugs</li>
    <li>Have the same active-ingredient formula as Brand-Name drugs</li>
    <li>Are rated by the Food and Drug Administration (FDA) to be as safe and effective as Brand-Name drugs.</li>
</ul>
 
<h3>Changes to the Formulary</h3>
<p>The formulary may change each month. There are many reasons why the formulary can change, such as:</p>
 
<ul>
    <li>Generic drugs may become available</li>
    <li>New drugs could be developed</li>
    <li>A drug is no longer manufactured</li>
    <li>The Food and Drug Administration deems a drug to be unsafe</li>
</ul>
 
<h3>Requesting Exceptions to the Formulary</h3>
 
<p>For information about requesting exceptions to our formulary, see our&nbsp;<a href="http://www.medi-carefirst.com/mcf/needinsurance/AppealsAndExceptions.html" title="Appeals and Exceptions" 
onclick="window.open(this.href,this.target,'scrollbars=yes,width=600,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Appeals and Grievances</a>&nbsp;section. Once you are a member, you will be told 60 days ahead of time about changes in the formulary that affect you. You can also learn about changes:</p>
 
<ul>
    <li>In the Drug Detail Section of the Drug Search results</li>
    <li>In the Web site's News section</li>
    <li>And in the Explanation of Benefits (EOB) that is mailed to members monthly.</li>
</ul>
 
 
<h3>Learn More</h3>
 
<p>The full list of covered prescription drugs and their general cost is called a formulary. If you have more questions about the formulary and how it works, please visit our <a href="http://notesnet.medi-carefirst.com/ecommerce/faqpartd.nsf/vwfaqbysectionplan?OpenView&lookUI=1&Category=faq2009partd">Frequently Asked Questions </a></p>
 
<p>If you would like to have a copy of the formulary sent to you when it is available, please call Claims Customer Service at 1-800-693-1434 (TTY/TDD: 1-800-693-0765), 24 hours a day/7 days a week.</p>
 
<p>For more information about the requirements surrounding prior authorization, please see our <a href="http://www.medi-carefirst.com/mcf/attachments/CY2009PACriteria.pdf">prior authorization criteria</a>.</p>
 
 
 
<p>&nbsp;</p><!--  end prospects  -->
                    </div><!--  end content  -->
 
					<!-- InstanceEndEditable -->
                    </div></div></div></div></div></div></div>     
                  </div><!--  end centerColumn  -->
 
                    <div id="rightColumn">
                    <div class="box">
                        <div class="top"><div class="left"><div class="right"><div class="tl"><div class="tr"><div class="bl"><div class="br">
                            <h3 class="first">Plan Resources</h3>
                            <div class="holder">
							    <!-- InstanceBeginEditable name="Resources" -->
                            	<ul>
                           	    <li><a href="AmIEligible.html" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Am I eligible?</a></li>
                                    <li><a href="../html/EducationalResources.html" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Educational Resources</a></li>
                                    <li><a href="../html/FAQs.html" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">FAQs</a></li>
                                    <li><a href="FormsAndApplications.html" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Forms &amp; Applications</a></li>
                                    <li><a href="AppealsAndExceptions.html" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Appeals &amp; Exceptions</a></li>
                                </ul>
                                <!-- InstanceEndEditable -->
                            </div>
                            
                            <h3>Additional Information</h3>
                            <div class="holder">
							    <!-- InstanceBeginEditable name="AdditionaInfo" -->
                            	<ul>
                               	  <li>Enrolling in a Part D plan does not replace your need for <a href="../redirects/Medicare.htm" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">Medicare</a> or your current Medigap plan.</li>
                                    <li>Blue Rx plans cover most drugs that Medicare has approved for Part D.</li>
                                    <li>Sign up when you become <a href="AmIEligible.html" onclick="window.open(this.href,this.target,'scrollbars=yes,width=620,height=400,left=100,top=75,links=yes,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes'); return false" target="_blank">eligible</a> or you may have to pay a penalty.</li>
                                </ul>
                                <!-- InstanceEndEditable -->
                            </div>
                            
                        </div></div></div></div></div></div></div>
                    </div>
                        <!-- InstanceBeginEditable name="seniorRx" -->
                        <div id="seniorRx" class="box">
                        <div class="top"><div class="left"><div class="right"><div class="tl"><div class="tr"><div class="bl"><div class="br">
                        	<img src="../images/interior/seniorDrugAssistance.png" width="180" height="76" alt="Senior Prescription Drug Assistance Program" />
                            
                            <div class="content">
                            	<p>We administer Maryland's SPDAP program</p>
                                <a href="#" class="arrowLink">Find out what it is &amp; if you're eligible.</a>
                            </div>
                            
                        </div></div></div></div></div></div></div>
                        </div><!-- InstanceEndEditable -->
                    </div><!--  end rightColumn  -->
 
	    </div><!--  end wrapper  -->
        <div id="footer">
        	<div class="lists">
            	<p>Last Updated/Reviewed: <script type="text/javascript">savedDate();</script></p>
                <ul class="first">
                    <li><a href="../html/index.html">Home</a></li>
                    <li><a href="../html/AboutUs.html">About Us</a></li>
                    <li><a href="../html/Glossary.html">Glossary</a></li>
                    <li><a href="../html/ContactUs.html">Contact Us</a></li>
                    <li class="last"><a href="../html/AccessibilityHelp.html">Accessibility Help</a></li>
                    <!--<li class="rssLink"><a href="#" class="rss">What's this?</a></li>-->
                </ul>	
                <ul>
                    <li><a href="../html/PrivacyStatement.html">Privacy Statement</a></li>
                    <li><a href="../html/ReportFraud.html">Report Fraud</a></li>
                    <li class="last"><a href="../html/SiteMap.html">Site Map</a></li>
                </ul>
                <p><a href="#" class="regStyles" onclick="setActiveStyleSheet('default'); return false;">Back to Graphics Version</a></p>
            </div>
            <p>Serving Maryland, Delaware and the District of Columbia. Medi-CareFirst BlueCross BlueShield is the business name of 
            First Care, Inc. and is an independent licensee of the Blue Cross and Blue Shield Association. &reg; Registered trademark 
            of the Blue Cross and Blue Shield Association. <br />&reg; Registered trademark of CareFirst of Maryland, Inc.</p>
            <p>Medi-CareFirst BlueCross BlueShield contracts with the Federal Government to provide Medicare prescription drug coverage.</p>
        </div><!--  end footer  -->
    </div><!--  end page  -->
</body>
<!-- InstanceEnd --></html>
                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-07-27 at 11:24:38ID24603856
Topics

JSON

,

JavaScript

,

Asynchronous Javascript and XML (AJAX)

Participating Experts
1
Points
500
Comments
28

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. jQuery session with jquery-json
    Hi all, I'm quite new to jQuery and I want to use one plugin, the jquery-json: http://code.google.com/p/jquery-json/ I'm attaching the js like this: <script type="text/javascript" src="jquery.json-1.3.js"></script> And after that I'm doing ...
  2. JSON help
    Dear Experts, Using JavaScript, how do I create a JSON value or string which can easily be read by a parser on the server? For example, I have 10 textboxes on my webpage, I would like to somehow capture all that text into JSON and send it to the server. I know how to send ...
  3. Using JSON with JavaScript
    Hi Experts, My question is with regards to using JSON with AJAX. I am just coming out of a meeting where the developers suggested that for the business to have control on our website, they will implement an AJAX solution that uses JSON to create an object of all the data ele...
  4. Loop JSON Properties
    Hello Experts - I am getting a JSON object using JQuery and .getJSON function. Is there a way to loop through object's properties and retrieve the name of each property? I'm new to JSON, so an examples would be great. Thanks.
  5. JSON and HTML
    Hi I'm wondering if it's possible to somehow obtain a JSON object from a HTML atribute. Something like this: The variable json will be a string. Can I then convert it to an object or array?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: kevin_uPosted on 2009-07-27 at 13:00:15ID: 24955367

Does what you have work so far?  Does it disply Title:, etc?  

Can you post the json result, and the format that you'd like the table?



 

by: Teamsite_NoobPosted on 2009-07-27 at 13:49:21ID: 24955865

NO it doesnt work, what I am missing in this is that I dont think I have any code to write the results ( that are part of the JSOn query) to a table. I cant figure out how to show the results in a table...

 

by: kevin_uPosted on 2009-07-27 at 14:08:14ID: 24956027

Please post the JSON result, and I'll help construct the function.

Can you describe the format of the result you'd like to see?

 

by: Teamsite_NoobPosted on 2009-07-27 at 16:08:09ID: 24956744

 

by: Teamsite_NoobPosted on 2009-07-27 at 17:42:32ID: 24957104

ok here is what the result looks like:

{"totalCount":90,"drugs":[{"brandName":"TYSABRI","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"300MG/15ML","tierCode":4,"cls":"MISCELLANEOUS THERAPEUTIC AGENTS","category":"MISCELLANEOUS THERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"23805","seqNum":65186},{"brandName":"ABILIFY DISCMELT","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"10MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"26445","seqNum":68193},{"brandName":"ABILIFY DISCMELT","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"15MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"26448","seqNum":68176},{"brandName":"ANTABUSE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"500MG","tierCode":2,"cls":"MISCELLANEOUS THERAPEUTIC AGENTS","category":"MISCELLANEOUS THERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"02882","seqNum":68689},{"brandName":"RISPERDAL M-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"1MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"19178","seqNum":69082},{"brandName":"DRONABINOL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"2.5MG","tierCode":1,"cls":"ANTIEMETICS, MISCELLANEOUS","category":"ANTIEMETICS","priorAuthSeqNum":-1,"genericAlt":"27990","seqNum":73136},{"brandName":"DRONABINOL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"5MG","tierCode":1,"cls":"ANTIEMETICS, MISCELLANEOUS","category":"ANTIEMETICS","priorAuthSeqNum":-1,"genericAlt":"27991","seqNum":73137},{"brandName":"DRONABINOL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"10MG","tierCode":1,"cls":"ANTIEMETICS, MISCELLANEOUS","category":"ANTIEMETICS","priorAuthSeqNum":-1,"genericAlt":"27992","seqNum":73138},{"brandName":"IMOVAX RABIES VACCINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"2.5 UNIT","tierCode":4,"cls":"VACCINES","category":"VACCINES","priorAuthSeqNum":-1,"genericAlt":"99542","seqNum":64770},{"brandName":"ANTABUSE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"250MG","tierCode":2,"cls":"MISCELLANEOUS THERAPEUTIC AGENTS","category":"MISCELLANEOUS THERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"02881","seqNum":66786},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"2MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"26305","seqNum":66982},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"100MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"00780","seqNum":68641},{"brandName":"ENABLEX","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB.SR 24H","strength":"15MG","tierCode":3,"cls":"GENITOURINARY SMOOTH MUSCLE RELAXANTS","category":"GENITOURINARY SMOOTH MUSCLE RELAXANTS","priorAuthSeqNum":-1,"genericAlt":"24044","seqNum":69757},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"300MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"00781","seqNum":67086},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"400MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"00782","seqNum":69272},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"300MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"23242","seqNum":69158},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"2G/20ML","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"34231","seqNum":72895},{"brandName":"LABETALOL HCL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"5MG/ML","tierCode":4,"cls":"BETA-ADRENERGIC BLOCKING AGENTS","category":"BETA-ADRENERGIC BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"18990","seqNum":72699},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"300MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"00781","seqNum":72527},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"800MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"94447","seqNum":72529},{"brandName":"CABERGOLINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"0.5MG","tierCode":1,"cls":"DOPAMINE RECEPTOR AGONISTS","category":"ANTIPARKINSONIAN AGENTS","priorAuthSeqNum":-1,"genericAlt":"26051","seqNum":69420},{"brandName":"ALCOHOL SWABS","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"MED. PAD","strength":"x","tierCode":3,"cls":"LOCAL ANTI-INFECTIVES, MISCELLANEOUS","category":"ANTI-INFECTIVES (SKIN-MUCOUS MEMBRANE)","priorAuthSeqNum":-1,"genericAlt":"28780","seqNum":72235},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"SOLUTION","strength":"1MG/ML","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"24062","seqNum":69783},{"brandName":"RISPERDAL M-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"4MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"25025","seqNum":69637},{"brandName":"DIABINESE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"250MG","tierCode":3,"cls":"SULFONYLUREAS","category":"ANTIDIABETIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"05732","seqNum":69564},{"brandName":"LORTAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"10MG-500MG","tierCode":3,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"70334","seqNum":69487},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"100MG","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"38540","seqNum":69445},{"brandName":"DYNABAC","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET DR","strength":"250MG","tierCode":3,"cls":"MACROLIDES","category":"ANTIBACTERIALS","priorAuthSeqNum":-1,"genericAlt":"40700","seqNum":69126},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"100MG/ML","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"34231","seqNum":69014},{"brandName":"LABETALOL HCL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"5MG/ML","tierCode":4,"cls":"BETA-ADRENERGIC BLOCKING AGENTS","category":"BETA-ADRENERGIC BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"18990","seqNum":68957},{"brandName":"ALTABAX","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"OINT.(GM)","strength":"1%","tierCode":3,"cls":"ANTIBACTERIALS (SKIN _ MUCOUS MEMBRANE)","category":"ANTI-INFECTIVES (SKIN-MUCOUS MEMBRANE)","priorAuthSeqNum":-1,"genericAlt":"98373","seqNum":68827},{"brandName":"LABETALOL HCL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"300MG","tierCode":1,"cls":"BETA-ADRENERGIC BLOCKING AGENTS","category":"BETA-ADRENERGIC BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"10340","seqNum":68677},{"brandName":"NABUMETONE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"500MG","tierCode":1,"cls":"NONSTEROIDAL ANTI-INFLAMMATORY AGENTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"32961","seqNum":68691},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"800MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"94447","seqNum":68609},{"brandName":"GUANABENZ ACETATE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"8MG","tierCode":1,"cls":"CENTRAL ALPHA-AGONISTS","category":"HYPOTENSIVE AGENTS","priorAuthSeqNum":-1,"genericAlt":"01401","seqNum":68129},{"brandName":"ALCOHOL SWABS","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"MED. PAD","strength":"","tierCode":1,"cls":"LOCAL ANTI-INFECTIVES, MISCELLANEOUS","category":"ANTI-INFECTIVES (SKIN-MUCOUS MEMBRANE)","priorAuthSeqNum":-1,"genericAlt":"28780","seqNum":68154},{"brandName":"NABUMETONE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"750MG","tierCode":1,"cls":"NONSTEROIDAL ANTI-INFLAMMATORY AGENTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"32962","seqNum":68025},{"brandName":"RIBATAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"600MG","tierCode":3,"cls":"NUCLEOSIDES AND NUCLEOTIDES","category":"ANTIVIRALS","priorAuthSeqNum":-1,"genericAlt":"26122","seqNum":67894},{"brandName":"AFEDITAB CR","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET SA","strength":"60MG","tierCode":1,"cls":"DIHYDROPYRIDINES","category":"CALCIUM-CHANNEL BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"02227","seqNum":67905},{"brandName":"LORTAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"5MG-500MG","tierCode":3,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"70331","seqNum":67861},{"brandName":"RIBATAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB DS PK","strength":"600-400MG","tierCode":3,"cls":"NUCLEOSIDES AND NUCLEOTIDES","category":"ANTIVIRALS","priorAuthSeqNum":-1,"genericAlt":"26123","seqNum":67877},{"brandName":"DIABETA","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"5MG","tierCode":3,"cls":"SULFONYLUREAS","category":"ANTIDIABETIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"05712","seqNum":67736},{"brandName":"FLUDARABINE PHOSPHATE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"50MG/2ML","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"23439","seqNum":67671},{"brandName":"MEPERITAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"50MG","tierCode":1,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"15991","seqNum":67626},{"brandName":"FLUDARABINE PHOSPHATE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"50MG","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"32981","seqNum":67610},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"500MG","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"38541","seqNum":67484},{"brandName":"GABITRIL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"4MG","tierCode":3,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"37980","seqNum":67419},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"400MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"23243","seqNum":67280},{"brandName":"RIBATAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"400MG","tierCode":3,"cls":"NUCLEOSIDES AND NUCLEOTIDES","category":"ANTIVIRALS","priorAuthSeqNum":-1,"genericAlt":"26119","seqNum":67294},{"brandName":"RISPERDAL M-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"3MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"25024","seqNum":67246},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"30MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"18541","seqNum":67141},{"brandName":"AFEDITAB CR","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET SA","strength":"30MG","tierCode":1,"cls":"DIHYDROPYRIDINES","category":"CALCIUM-CHANNEL BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"02226","seqNum":67145},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"2G","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"38543","seqNum":66978},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"20MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"18539","seqNum":66632},{"brandName":"LABETALOL HCL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"200MG","tierCode":1,"cls":"BETA-ADRENERGIC BLOCKING AGENTS","category":"BETA-ADRENERGIC BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"10341","seqNum":66556},{"brandName":"DIABETA","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"2.5MG","tierCode":3,"cls":"SULFONYLUREAS","category":"ANTIDIABETIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"05711","seqNum":66460},{"brandName":"LORTAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"2.5-500MG","tierCode":3,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"70338","seqNum":66452},{"brandName":"GABITRIL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"16MG","tierCode":3,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"37982","seqNum":66339},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"15MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"18538","seqNum":66288},{"brandName":"GABITRIL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"12MG","tierCode":3,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"37981","seqNum":66084},{"brandName":"K-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET SA","strength":"10MEQ","tierCode":3,"cls":"REPLACEMENT PREPARATIONS","category":"REPLACEMENT PREPARATIONS","priorAuthSeqNum":-1,"genericAlt":"03510","seqNum":65959},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"10MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"18537","seqNum":65966},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"100MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"23239","seqNum":65845},{"brandName":"LABETALOL HCL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"100MG","tierCode":1,"cls":"BETA-ADRENERGIC BLOCKING AGENTS","category":"BETA-ADRENERGIC BLOCKING AGENTS","priorAuthSeqNum":-1,"genericAlt":"10342","seqNum":65854},{"brandName":"MEPERITAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"100MG","tierCode":1,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"15990","seqNum":65860},{"brandName":"ABRAXANE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"100MG","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"24094","seqNum":65789},{"brandName":"DIABETA","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"1.25MG","tierCode":3,"cls":"SULFONYLUREAS","category":"ANTIDIABETIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"05710","seqNum":65466},{"brandName":"FABRAZYME","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"5MG","tierCode":4,"cls":"ENZYMES","category":"ENZYMES","priorAuthSeqNum":-1,"genericAlt":"22348","seqNum":65089},{"brandName":"ABELCET","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"5MG/ML","tierCode":4,"cls":"POLYENES","category":"ANTIFUNGALS","priorAuthSeqNum":-1,"genericAlt":"07382","seqNum":65092},{"brandName":"RABAVERT","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"KIT","strength":"2.5 UNIT","tierCode":4,"cls":"VACCINES","category":"VACCINES","priorAuthSeqNum":-1,"genericAlt":"33921","seqNum":64771},{"brandName":"FABRAZYME","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"35MG","tierCode":4,"cls":"ENZYMES","category":"ENZYMES","priorAuthSeqNum":-1,"genericAlt":"18997","seqNum":64656},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"600MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"94624","seqNum":69691},{"brandName":"GUANABENZ ACETATE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"4MG","tierCode":1,"cls":"CENTRAL ALPHA-AGONISTS","category":"HYPOTENSIVE AGENTS","priorAuthSeqNum":-1,"genericAlt":"01400","seqNum":67421},{"brandName":"GABAPENTIN","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"CAPSULE","strength":"400MG","tierCode":1,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"00782","seqNum":72528},{"brandName":"AVELOX ABC PACK","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"400MG","tierCode":3,"cls":"QUINOLONES","category":"ANTIBACTERIALS","priorAuthSeqNum":-1,"genericAlt":"50767","seqNum":67270},{"brandName":"ENABLEX","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB.SR 24H","strength":"7.5MG","tierCode":3,"cls":"GENITOURINARY SMOOTH MUSCLE RELAXANTS","category":"GENITOURINARY SMOOTH MUSCLE RELAXANTS","priorAuthSeqNum":-1,"genericAlt":"24043","seqNum":67990},{"brandName":"ERY-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET DR","strength":"250MG","tierCode":3,"cls":"MACROLIDES","category":"ANTIBACTERIALS","priorAuthSeqNum":-1,"genericAlt":"40730","seqNum":66808},{"brandName":"ERY-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET DR","strength":"333MG","tierCode":3,"cls":"MACROLIDES","category":"ANTIBACTERIALS","priorAuthSeqNum":-1,"genericAlt":"40731","seqNum":67202},{"brandName":"ERY-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET DR","strength":"500MG","tierCode":3,"cls":"MACROLIDES","category":"ANTIBACTERIALS","priorAuthSeqNum":-1,"genericAlt":"40732","seqNum":67493},{"brandName":"VIBRA-TABS","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"100MG","tierCode":3,"cls":"TETRACYCLINES","category":"ANTIBACTERIALS","priorAuthSeqNum":-1,"genericAlt":"40360","seqNum":65742},{"brandName":"DIABINESE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"100MG","tierCode":3,"cls":"SULFONYLUREAS","category":"ANTIDIABETIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"05731","seqNum":65823},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"20MG/ML","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"34230","seqNum":66720},{"brandName":"GABITRIL","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"2MG","tierCode":3,"cls":"ANTICONVULSANTS, MISCELLANEOUS","category":"ANTICONVULSANTS","priorAuthSeqNum":-1,"genericAlt":"54681","seqNum":66994},{"brandName":"LORTAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"7.5-500MG","tierCode":3,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"70339","seqNum":69705},{"brandName":"LORTAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"SOLUTION","strength":"7.5-500/15","tierCode":3,"cls":"OPIATE AGONISTS","category":"ANALGESICS AND ANTIPYRETICS","priorAuthSeqNum":-1,"genericAlt":"20906","seqNum":66445},{"brandName":"CYTARABINE","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"1G","tierCode":4,"cls":"ANTINEOPLASTIC AGENTS","category":"ANTINEOPLASTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"38542","seqNum":69077},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TABLET","strength":"5MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"20173","seqNum":67714},{"brandName":"ABILIFY","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"VIAL","strength":"9.75MG/1.3","tierCode":4,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"97696","seqNum":68362},{"brandName":"RISPERDAL M-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"0.5MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"19541","seqNum":65628},{"brandName":"RISPERDAL M-TAB","yearFlag":"2009","quantityLimitSeqNum":-1,"dosage":"TAB RAPDIS","strength":"2MG","tierCode":2,"cls":"ANTIPSYCHOTIC AGENTS","category":"PSYCHOTHERAPEUTIC AGENTS","priorAuthSeqNum":-1,"genericAlt":"19179","seqNum":67014}],"success":true}

 

by: kevin_uPosted on 2009-07-27 at 18:14:36ID: 24957205

as you've probably already figured out the json contains elements organized like this:

    'totalCount' => "90"
    'drugs' ...
        '0' ...
            'brandName' => "TYSABRI"
            'yearFlag' => "2009"
            'quantityLimitSeqNum' => "-1"
            'dosage' => "VIAL"
            'strength' => "300MG/15ML"
            'tierCode' => "4"
            'cls' => "MISCELLANEOUS THERAPEUTIC AGENTS"
            'category' => "MISCELLANEOUS THERAPEUTIC AGENTS"
            'priorAuthSeqNum' => "-1"
            'genericAlt' => "23805"
            'seqNum' => "65186"
        '1' ...

Knowing that I iterated the 'drugs' array, and built a simple html table from the contents.

The code snippet is a replacement doIT function.

I am unable to test your page, so I'm assuming that your AJAX works.   Since you're using JQuery already, I'm going to post another version that uses JQuery's AJAX.

function doIT(){
	var temp=new XMLHttpRequest("GET","http://dveweb3.carefirst.com/meddinfo/drug/findDrugController.json?by=name&year=2009&drugNamePattern=ab");   
	temp.onreadystatechange=function()
	{
	 
	if (this.readyState==4) 
	{
	 
	   eval("var retrievedData="+this.responseText);  
	 
	   var content=document.getElementById("MYJSON")  
	 
 
        var h = '<table width="100%">\n';
        h += '<tr>\n';
        h += '<th>Brand Name</th>\n';
        h += '<th>Year</th>\n';
        h += '<th>Quantity(LimitSeqNum)</th>\n';
        h += '<th>Disage</th>\n';
        h += '<th>Strength</th>\n';
        h += '<th>Tier Code</th>\n';
        h += '<th>Class</th>\n';
        h += '<th>Category</th>\n';
        h += '<th>Prior Auth(seqnum)</th>\n';
        h += '<th>Generic Alt</th>\n';
        h += '<th>Sequence Number</th>\n';
        h += '</tr>\n';
        for (var i=0;i<j.drugs.length;i++)
        {
                var dr = j.drugs[i];
                h += '<tr>\n';
                h += '<td>'+dr.brandName+'</td>';
                h += '<td>'+dr.yearFlag+'</td>';
                h += '<td>'+dr.quantityLimitSeqNum+'</td>';
                h += '<td>'+dr.dosage+'</td>';
                h += '<td>'+dr.strength+'</td>';
                h += '<td>'+dr.tierCode+'</td>';
                h += '<td>'+dr.cls+'</td>';
                h += '<td>'+dr.category+'</td>';
                h += '<td>'+dr.priorAuthSeqNum+'</td>';
                h += '<td>'+dr.genericAlt+'</td>';
                h += '<td>'+dr.seqNum+'</td>';
                h += '</tr>\n';
        }
        h += '</table>\n';
         content.innerHTML = h;
 
	}
	 
	}
	temp.send(null);  // now execute
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:

Select allOpen in new window

 

by: Teamsite_NoobPosted on 2009-07-27 at 18:20:02ID: 24957226

Ok pardon my ignorance here...but I just replaced my DOIT function with yours..and clicked on the Search button that is supposed to trigger this function...I was expecting it to show a table with the results...what am I missing??..apart from some common sense...obviously..lol

 

by: kevin_uPosted on 2009-07-27 at 18:24:08ID: 24957240

ok.. again I couldn't check out your original ajax, so here is a new doIT replacement that uses jquery AJAX instead.   If this doesn't do anything, i'll have to build a little test bed using your page and do more testing.

function doIT(){
 
        $.getJSON("http://dveweb3.carefirst.com/meddinfo/drug/findDrugController.json?by=name&year=2009&drugNamePattern=ab" ,
        function(data){
 
                var h = '<table width="100%">\n';
                h += '<tr>\n';
                h += '<th>Brand Name</th>\n';
                h += '<th>Year</th>\n';
                h += '<th>Quantity(LimitSeqNum)</th>\n';
                h += '<th>Disage</th>\n';
                h += '<th>Strength</th>\n';
                h += '<th>Tier Code</th>\n';
                h += '<th>Class</th>\n';
                h += '<th>Category</th>\n';
                h += '<th>Prior Auth(seqnum)</th>\n';
                h += '<th>Generic Alt</th>\n';
                h += '<th>Sequence Number</th>\n';
                h += '</tr>\n';
                for (var i=0;i<data.drugs.length;i++)
                {
                        var dr = data.drugs[i];
                        h += '<tr>\n';
                        h += '<td>'+dr.brandName+'</td>';
                        h += '<td>'+dr.yearFlag+'</td>';
                        h += '<td>'+dr.quantityLimitSeqNum+'</td>';
                        h += '<td>'+dr.dosage+'</td>';
                        h += '<td>'+dr.strength+'</td>';
                        h += '<td>'+dr.tierCode+'</td>';
                        h += '<td>'+dr.cls+'</td>';
                        h += '<td>'+dr.category+'</td>';
                        h += '<td>'+dr.priorAuthSeqNum+'</td>';
                        h += '<td>'+dr.genericAlt+'</td>';
                        h += '<td>'+dr.seqNum+'</td>';
                        h += '</tr>\n';
                }
                h += '</table>\n';
 
                var content=document.getElementById("MYJSON")
                content.innerHTML = h;
 
        });
}
~
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:

Select allOpen in new window

 

by: Teamsite_NoobPosted on 2009-07-27 at 18:34:20ID: 24957286

ok this looks a lot similar to what I had come up with..after a lot of googling..I am posting my function as well..but both dont seem to work..the JSON URL does work..the results I posted above is what I got by just copy pasting that URL in a browser

<html>
  <head>
    <script type="text/javascript" src="jquery.js"></script>
 
    <script type="text/javascript">
	
	function search(){
      $(document).ready (function(){
var jsonvar = "http://dveweb3.carefirst.com/meddinfo/"+ "drug/findDrugController.json?by=name"+"&year=2009&drugNamePattern=ab";
$.getJSON(jsonvar, function(data)
{
	$.each(data, function(i, item)
						  {
    $('<p></p>')
    	.addclass(i%2?'even':'odd').html('<table>'+'<tr>\n'+'<td>'+dr.brandName+'</td>'
                         + '<td>'+dr.yearFlag+'</td>'
                         + '<td>'+dr.quantityLimitSeqNum+'</td>'
                        +'<td>'+dr.dosage+'</td>'
                        + '<td>'+dr.strength+'</td>'
                        + '<td>'+dr.tierCode+'</td>'
                         +'<td>'+dr.cls+'</td>'
                         +'<td>'+dr.category+'</td>'
                        +'<td>'+dr.priorAuthSeqNum+'</td>'
                         +'<td>'+dr.genericAlt+'</td>'
                         +'<td>'+dr.seqNum+'</td>'
                        +'</tr>\n'+'</table>').appendTo('#MYJSON');
   
  });
  });
								  }
 </script>
  </head>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:

Select allOpen in new window

 

by: Teamsite_NoobPosted on 2009-07-27 at 18:35:46ID: 24957293

the HTML as you will notice is copied from your function..I just realize..I havent initialized the dr variable in my function...but that was just to show you on what lines..I was working on it....

 

by: kevin_uPosted on 2009-07-27 at 18:38:45ID: 24957309

yup i got the idea....

dveweb3.carefirst.com does not resolve here, so I can't try the url.  I assume its an internal address?

Silly question, is the web page hosted on the same domain?  If not, ajax will fail.  Cross site scripting is not allowed in the browser.  

 

by: Teamsite_NoobPosted on 2009-07-27 at 18:42:59ID: 24957333

yup it is hosted on the same domain...like I said I get the results when I paste the link in my browser...I found this twitter object on  a website..maybe we can use that as the search result on my page and put it in a simple table..so we can both see it...I am not too worried abt the exact HTML...if we are able to make this work..I should be able to put the rest of the HTML around it...appreciate all your help...you have been awesome..here is the object

http://twitter.com/status/user_timeline/sitepointdotcom.json?count=5&callback=yourfunction

 

by: kevin_uPosted on 2009-07-27 at 19:01:02ID: 24957399

i'm still working on this. trying to track down my own bug now.

 

by: Teamsite_NoobPosted on 2009-07-27 at 19:05:27ID: 24957416

thanks!!!

 

by: kevin_uPosted on 2009-07-27 at 19:22:58ID: 24957476

Two things:

1) comment out the <form> tags (leave the input boxes active)

<!--<form id="searchForm" method="post" acton="" "> -->
        <input name="queryfield" type="text" maxlength=75 class="searchInput">
        <input name="" class="go" type="image" src="http://www.medi-carefirst.com/mcf/images/interior/btn_go.gif" onClick="doIT();" >
<!-- </form> -->

Since you're doing an ajax query we don't want to do a submit, because that would cancel any pending javscript activity (like the onclick).

An image input tag is automatically a submit button.


2) When you access the HTML code that you are working with, is it from "http://dveweb3.carefirst.com" ? it must be from the same domain and subdomain exactly.   Otherwise AJAX will fail.   With one exception:  If you have JSONP avalialbe on the server like twitter does.  JSONP allows cross site scripting with the cooperation of the server.  The &callback= is the trigger for that.

So, I do have the twitter one working... I'll post that in a minute.

 

by: kevin_uPosted on 2009-07-27 at 19:24:34ID: 24957481

Here is the twitter example working.  I commented out the form tags on your page as I explained earlier.. then the code snippet has the doIT() function.

The data structure is completely different, so accessing the items is different:
   '0' ...
        'text' => "Microsoft Backtracks on Browser-less Windows 7 E http://bit.ly/QgFFO"
        'in_reply_to_status_id' ...
        'user' ...
            'profile_sidebar_border_color' => "dde6f2"
            'description' => "sitepoint.com is THE online resource for web designers, developers and dealmakers. Follow us for site updates, freebies, deals, füsball game reports and more!"
            'utc_offset' => "36000"
            'created_at' => "Wed Aug 06 00:02:41 +0000 2008"
            'profile_text_color' => "333333"

function doIT(){
 
        $.getJSON("http://twitter.com/status/user_timeline/sitepointdotcom.json?count=5&callback=?",
        function(data){
                var h = '';
                h += '<table width="100%" border=1>\n';
                h += '<tr>\n';
                h += '<th>Screen Name</th>\n';
                h += '<th>Name</th>\n';
                h += '<th>Followers</th>\n';
                h += '</tr>\n';
                for (var i=0;i < data.length; i++)
                {
                        var dr = data[i].user;
                        h += '<tr>\n';
                        h += '<td>'+dr.screen_name+'</td>';
                        h += '<td>'+dr.name+'</td>';
                        h += '<td>'+dr.followers_count+'</td>';
                        h += '</tr>\n';
                }
                h += '</table>\n';
                var content=document.getElementById("MYJSON")
                content.innerHTML = h;
        });
}

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:

Select allOpen in new window

 

by: Teamsite_NoobPosted on 2009-07-27 at 20:22:26ID: 24957656

yea now how I have to make this thing work is that it reads the text in the search box, and then the URL will probably have a dynamic variable that I will initialize the text to or maybe just append the search string at the end of the URL( the IT will give us the final URL, the one I currently have is for a POC with the search string hard coded....is that possible without using FORM>>>?>

 

by: kevin_uPosted on 2009-07-27 at 20:28:32ID: 24957679

yes, the input tags will work just fine without a form.

You'll have to give your search input tag an ID="something" so you can do document.getElementById('something').value

Remember how you access the data is dependant on how the data is structured.  So you need to examine the json data.

There is a nice little chunk of code here:
http://www.openjs.com/scripts/others/dump_function_php_print_r.php

which will allow  you to dump the JSON object into a string that breaks down the object.  You can place that string into an extra divison (along with <pre> </pre> tags) to get a little extra debugging capability.


 

by: Teamsite_NoobPosted on 2009-07-28 at 17:32:01ID: 24966396

ok what am I doing wrong here...I just plugged the DOIt function for twitter onto my page...deployed it to my dev site and clicked on go...nothing happened.... I dont even get like a javascript error

 

by: kevin_uPosted on 2009-07-29 at 12:52:09ID: 24973907

did you comment out the <form> as i mentioned in a prior post?
1) comment out the <form> tags (leave the input boxes active)

<!--<form id="searchForm" method="post" acton="" "> -->
        <input name="queryfield" type="text" maxlength=75 class="searchInput">
        <input name="" class="go" type="image" src="http://www.medi-carefirst.com/mcf/images/interior/btn_go.gif" onClick="doIT();" >
<!-- </form> -->

 

by: Teamsite_NoobPosted on 2009-07-30 at 10:54:25ID: 24982520

I think I know what the problem is...I think I need to use the $.each method, I just need help with inserting the rihgt html using the $.each method for the results table to look like the one on this page

http://notesnet.medi-carefirst.com/ecommerce/formulary2009.nsf/vwwebbyname?searchview&query=(FIELD+GenericName+=*tylenol*+And+FIELD+SearchGeneric+=1)+OR+FIELD+BrandName+=+*tylenol*&Start=1&Count=1000&SearchMax=1000&SearchOrder=4


Thanks for your help!!

 

by: kevin_uPosted on 2009-07-30 at 11:45:05ID: 24983097

that url doesnt work for me.

I had already given you a method to iterate over the drugs array within the json result.

 

by: Teamsite_NoobPosted on 2009-07-30 at 12:49:14ID: 24983741

ok here are two versions of a file, I have the first one working ( th eflicker code) and the second one doesnt. What am I doing wrong, I am thinking its the way I am trying to retrieve the items from my JSOn object

FLICKER CODE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
   $('#button1').click(function() {
    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
            $("<img/>").attr("src", item.media.m).appendTo("#images");
          });
        });
  });
  });
 
  </script>
</head>
<body>
  <div id="images">
  </div>
  <input id="button1" type="button" value="Hello"/>
</body>
</html>
MY CODE
 
function doIT(){
 
        $.getJSON("http://dveweb3.carefirst.com/meddinfo/drug/findDrugController.json?by=name&year=2009&drugNamePattern=ab" ,
        function(data){
                                                                                $.each(data, function(i,dr){
                                                                                                                                                                  $("<table/>").html('<tr>\n'+'<td>'+dr.brandname+'</td>'+'<td>'+dr.yearFlag+'</td>'+'<td>'+dr.quantityLimitSeqNum+'</td>'+'<td>'+dr.dosage+'</td>'+'<td>'+dr.strength+'</td>'+'<td>'+dr.tierCode+'</td>'+'<td>'+dr.cls+'</td>'+'<td>'+dr.category+'</td>'+'<td>'+dr.priorAuthSeqNum+'</td>'+'<td>'+dr.genericAlt+'</td>'+'<td>'+dr.seqNum+'</td>'+'</tr>')
                                                                                                                                                                  .appendto("#MYJSON");
                
                                                                                                                                                                  });
 
               
        });
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

Select allOpen in new window

 

by: kevin_uPosted on 2009-07-30 at 13:59:55ID: 24984357

First, the object that we were originally working with called the array "drugs"

Therefore:
                $.each(data, function(i,dr){
s/b
                $.each(data.drugs, function(i,dr){

Second, I think we need to verify that we're even getting ANY data.
So I would add an alert, to say that it worked.  Then, since your object contains 'totalCount', we can also show that.  That way we know we actually have data.
function(data) {
   alert('ajax was successful');
   alert('data.totalCount: '+data.totalCount);
..
   and inside the loop:
      alert('dr.brandName: '+dr.brandName);

Thrid, I don't think you want to add a new table for each drug.  I don't belive you can handle tables that way.   There is a way to do it, but the original method for creating the table should be better.   At this point I left it the same.

So here is a new doIT with some alerts to see if we're actually getting any data.

function doIT(){
 
        $.getJSON("http://dveweb3.carefirst.com/meddinfo/drug/findDrugController.json?by=name&year=2009&drugNamePattern=ab" ,
        function(data){
		alert('ajax was successful');
		alert('data.totalCount: '+data.totalCount);
                $.each(data.drugs, function(i,dr){
			alert('dr.brandName: '+dr.brandName);
                        $("<table/>").html('<tr>\n'+'<td>'+dr.brandname+'</td>'+'<td>'+dr.yearFlag+'</td>'+'<td>'+dr.quantityLimitSeqNum+'</td>'+'<td>'+dr.dosage+'</td>'+'<td>'+dr.strength+'</td>'+'<td>'+dr.tierCode+'</td>'+'<td>'+dr.cls+'</td>'+'<td>'+dr.category+'</td>'+'<td>'+dr.priorAuthSeqNum+'</td>'+'<td>'+dr.genericAlt+'</td>'+'<td>'+dr.seqNum+'</td>'+'</tr>')
                                                         .appendto("#MYJSON");
		}
	);
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:

Select allOpen in new window

 

by: Teamsite_NoobPosted on 2009-07-31 at 05:53:00ID: 24988269

I get all three alerts in IE, no alerts in firefox and still no data on the page...that is weird....

 

by: kevin_uPosted on 2009-07-31 at 15:47:40ID: 24993050

ok, it should have said "ajax was sucessful"
then, data.totalCount -- and a number.
then, dr.brandName along with a brand name several times.

Did it do that?

Lets simplify it more:

Now it should just add several brand name lines to the MYJSON division.

function doIT(){
 
        $.getJSON("http://dveweb3.carefirst.com/meddinfo/drug/findDrugController.json?by=name&year=2009&drugNamePattern=ab" ,
        function(data){
		alert('ajax was successful');
		alert('data.totalCount: '+data.totalCount);
                $.each(data.drugs, function(i,dr){
			alert('dr.brandName: '+dr.brandName);
                        $("<p>"+dr.brandName+"</p>").appendto("#MYJSON");
		}
	);
}

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

Select allOpen in new window

 

by: Teamsite_NoobPosted on 2009-07-31 at 15:57:51ID: 24993108

Is there any difference in how u handle URLs with callback and the ones without..the code u have
provided has worked for all URLs with callback enabled..ofcourse with minor changes in the HTML
..but doesn't work with my URL..

 

by: kevin_uPosted on 2009-07-31 at 16:08:59ID: 24993163

I tried to explain this in a prior post.

The other URLs are using JSONP (json proxy) -- they have "&callback=?", which allows cross domain json retreaval.  The server must support JSONP specifically, otherwise it won't work.  Those servers obviously do.

Your call is JSON (not proxy) so therefore the domain in the getJSON must match exactly the domain that the page is served on.   The entire domain name.   So lets say you're serving your page on www.xyz.com.  If your getJSON call says "http://www.xyz.com/somejasonurl" it will work.   If your getJSON call says "http://subdomain.xyz.com/somejsonurl" it will fail.  No data will be transferred.  This is a browser security feature that prevents cross site scripting.

IF your server supports JSONP (json proxy), then you'll be fine (with &callback=?)

Thats the issue with URLS and callbacks.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...