Thanks all for looking into this.. I've created a template (i.e action.tt) file and the variables in stash are rendered in this page. The HTML's element is getting rendered with the output from Ajax call.
The problem now is, I see my main page and the action page (rendered from ajax) together. Just because the "action.tt" takes the default style I see entire page duplication(with menus, status, links) in the rendered element of main page. Can we make a template without taking default style available for site? Also, I'm pretty much open to any of the Javascript framework, I know little about JQuery also. But I want to see a small demo which is integrated with Catalyst. Do somebody have such demo or link for the same? Thanks, ROhan On Wed, Jan 5, 2011 at 11:14 PM, Mesdaq, Ali <[email protected]> wrote: > I recommend testing this using Firefox with Firebug enabled so you can > watch the AJAX request and you can also print to the console to see what > your response looks like to make sure it’s what you’re expecting > > > > console.log(xmlhttp.responseText); > > document.getElementById("data").innerHTML=xmlhttp.responseText; > > > > Thanks, > > ------------------------------------------ > > Ali Mesdaq (CISSP, GIAC-GREM) > > Sr. Security Researcher > > Websense Security Labs > > http://www.WebsenseSecurityLabs.com <http://www.websensesecuritylabs.com/> > > ------------------------------------------ > > > > *From:* Rohan M [mailto:[email protected]] > *Sent:* Wednesday, January 05, 2011 3:07 AM > *To:* [email protected] > *Subject:* [Catalyst] Ajax Problem. > > > > Dear All, > > > > I want to use Ajax in my Catalyst application. > > > > Thing's that I've done till now : > > > > 1) Created a Javascript function on an event (onblur event) in my view (tt > page). > > 2) Created xmlhttp object in that Javascript function. > > 3) Called the '/controller/action' path with parameters. > > 4) The Action subroutine searches database and puts results in the *stash* > > > > I could see, the things are working till the fourth step correctly. > > > > Now, how can I render the stash variables in the current tt page? > > > > Or Will I need to parse the entire content? > > > > Is there a better solution for this problem? > > > > Any help or similar (simple) example will be appreciable. > > > > CODE SNIPPET > > ======================================================================= > > > > function getDetails(id) > > { > > var param = "id="+id; > > if (window.XMLHttpRequest) > > { > > xmlhttp=new XMLHttpRequest(); > > } > > else > > { > > xmlhttp=new > ActiveXObject("Microsoft.XMLHTTP"); > > } > > > > > xmlhttp.open("GET","/indexer/getid/"+"?"+param,true); > > // /controller/action url > > xmlhttp.send(); > > xmlhttp.onreadystatechange=function() > > { > > if (xmlhttp.readyState==4 && > xmlhttp.status==200) > > { > > > document.getElementById("data").innerHTML=xmlhttp.responseText; > > // the element to render output > > } > > } > > show(); > > > > } > > > > ======================================================================= > > > > > > Thanks and regards, > > Rohan > > > > > > Click here <https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==> to > report this email as spam. > > > Protected by Websense Hosted Email Security — www.websense.com > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[email protected]/ > Dev site: http://dev.catalyst.perl.org/ > >
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
