Dear All,<div><br></div><div>I want to use Ajax in my Catalyst application.</div><div><br></div><div>Thing&#39;s that I&#39;ve done till now :</div><div><br></div><div>1) Created a Javascript function on an event (onblur event) in my view (tt page).</div>
<div>2) Created xmlhttp object in that Javascript function.</div><div>3) Called the &#39;/controller/action&#39; path with parameters.</div><div>4) The Action subroutine searches database and puts results in the <b>stash</b></div>
<div><b><br></b></div><div><b><span class="Apple-style-span" style="font-weight: normal; ">I could see, the things are working till the fourth step correctly.</span></b></div><div><br></div><div>Now, how can I render the stash variables in the current tt page?</div>
<div><br></div><div>Or Will I need to parse the entire content?</div><div><br></div><div>Is there a better solution for this problem?</div><div><br></div><div>Any help or similar (simple) example will be appreciable.</div>
<div><br></div><div>CODE SNIPPET</div><div>=======================================================================</div><div><br></div><div><div>function getDetails(id)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>var param = &quot;id=&quot;+id;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (window.XMLHttpRequest)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>xmlhttp=new XMLHttpRequest();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>else</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>xmlhttp=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>xmlhttp.open(&quot;GET&quot;,&quot;/indexer/getid/&quot;+&quot;?&quot;+param,true);</div>
<div>                // /controller/action url </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>xmlhttp.send();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>xmlhttp.onreadystatechange=function()</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>document.getElementById(&quot;data&quot;).innerHTML=xmlhttp.responseText;</div><div>                                // the element to render output </div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>show();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div></div><div><br></div><div>=======================================================================</div><div><br></div><div><br></div>
<div>Thanks and regards,</div><div>Rohan</div><div><br></div>