trigger.io - How to retrieve contents from an asp page using Forge API? -
i new trigger.io , wondering if can provide complete example content external asp page. basically, trying achieve similar following code forge api.
<!doctype html> <html> <head> <script> function showhint(str) { var xmlhttp; if (str.length==0) { document.getelementbyid("txthint").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("txthint").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","gethint.asp?q="+str,true); xmlhttp.send(); } </script> </head> <body> <h3>start typing name in input field below:</h3> <form action=""> first name: <input type="text" id="txt1" onkeyup="showhint(this.value)" /> </form> <p>suggestions: <span id="txthint"></span></p> </body> </html>
thanks b jay
haven't tested this, you're looking forge.request.ajax
method:
function showhint(str) { if (!str) { return; } if (str.length === 0) { document.getelementbyid("txthint").innerhtml=""; return; } forge.request.ajax({ type: 'get', url: 'http://my.server.com/gethint.asp', data: { q: str }, success: function(response) { if (!response) { return; } document.getelementbyid("txthint").innerhtml=response; } }); }
check out trigger.io forge.request documentation more advanced options.
Comments
Post a Comment