Caching in AJAX?

Hi,
I want to cache the AJAX response in an Array in javascript.So that i can reuse it when ever needed.So that i can avoid unnecessary server hits. Please do provide an example for this. So that it will be really helpful.
Thanks

Why are you asking this in a Java forum? Use a DHTML/Javascript forum instead.

Similar Messages

  • Jnitiator console errors

    Hi,
    I m trying to access online application. when i try to open any form after logon, jar start download and in jnitiator console errors come
    Oracle JInitiator: Version 1.3.1.21
    Using JRE version 1.3.1.21-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\sahil
    User has overriden browser's proxy settings.
    Proxy Configuration: no proxy
    JAR cache enabled
    Location: C:\Documents and Settings\sahil\Oracle Jar Cache
    Maximum size: 50 MB
    Compression level: 0
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    Oracle JInitiator: Version 1.3.1.21
    Using JRE version 1.3.1.21-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\kr25421
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class oracle/apps/fnd/formsClient/FormsLauncher.class not found.
    java.lang.ClassNotFoundException: java.net.ConnectException: Operation timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpClient.<init>(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpClient.New(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpURLConnection.createConnection(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpURLConnection.connect(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    WARNING: Unable to cache http://ajax.pestal.co.uk:8001/OA_JAV...r/fndforms.jar
    System configuration is OS: Windows xp sp2
    VPN is connected
    Edited by: user9536785 on Jan 10, 2010 9:18 PM
    Waiting for reply, nobody knows answer of this thread.

    If you are working with a VPN, you need to check with the VPN administrator, cause Jinitiator will try to connect over the vpn and it won't be able to connect and download the files.
    Hope this helps.
    Greetings.

  • JINITIATOR CONSOLE ERROR

    Hi,
    I m trying to access online application. when i try to open any form after logon, jar start download and in jnitiator console errors come
    Oracle JInitiator: Version 1.3.1.21
    Using JRE version 1.3.1.21-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\sahil
    User has overriden browser's proxy settings.
    Proxy Configuration: no proxy
    JAR cache enabled
    Location: C:\Documents and Settings\sahil\Oracle Jar Cache
    Maximum size: 50 MB
    Compression level: 0
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    Oracle JInitiator: Version 1.3.1.21
    Using JRE version 1.3.1.21-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\kr25421
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class oracle/apps/fnd/formsClient/FormsLauncher.class not found.
    java.lang.ClassNotFoundException: java.net.ConnectException: Operation timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpClient.<init>(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpClient.New(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpURLConnection.createConnection(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpURLConnection.connect(Unknown Source)
    at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    WARNING: Unable to cache http://ajax.pestal.co.uk:8001/OA_JAV...r/fndforms.jar
    System configuration is OS: Windows xp sp2
    VPN is connected

    Did you check you forms application.log for FRM-93000?
    Normally on serverside you receive this error.
    Its is because in some forms the Fill pattern is set to None instead to a value like Transparent.
    Change this in one form and test if your frm is sill coming up.
    regards
    Michel

  • CFDIV posting form

    I am attempting to post a form from inside of a cfdiv and
    when I do I get a "Bad Request(Invalid Verb) error. The only
    solution I have been able to come up with is to post to a cfm.
    Inside the cfm I invoke my function and then change the source of
    the cfdiv.
    This is my first attempt at using the AJAX inside of CF8.
    Another issue is it seems like my pages are being cached and
    I don't have a solution either.
    Any helpwill be really appreciated.
    Brian

    re "Bad Request" error: please post your code, both cfc
    function and
    ajax request code.
    re caching of ajax requests: again, while it is highly
    possible that IE
    aggressively caches them, seeing a sample code that is a
    victim of IE's
    caching will be very helpful in determining if it is just IE
    at fault
    here or not...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Trying to read a textfile with AJAX and Caching

    Hello all,
    I have a simple jsp that utilizes ajax to read the contents of a text file<%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.util.*,java.io.*"%>
    <%
        Date date = new Date();
        String dateString = date.toString();
    %>
    <html lang="en" dir="ltr">
      <head>
        <meta http-equiv="refresh" content="20" url="ajax.jsp?ms='<%=date.getTime()%>'">
        <META HTTP-EQUIV="EXPIRES" CONTENT="-1">
        <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Example</title>
    <script type="text/javascript"><!--
    var xmlObj = null;
    function ajaxRead(file){
      //var xmlObj = null;
      if(window.XMLHttpRequest){
          xmlObj = new XMLHttpRequest();
      } else if(window.ActiveXObject){
          xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
      } else {
          return;
      xmlObj.onreadystatechange = function(){
        if(xmlObj.readyState == 4){
           updateObj('ta', xmlObj.responseText);
        xmlObj.open ('GET', file, true);
        xmlObj.send ('');
      function updateObj(obj, data){
       document.getElementById(obj).firstChild.data = data;
       alert(window.getURL());
      //--></script>
      </head>
      <body onload="ajaxRead('logger/Jan26EventLog.txt'); this.style.display='none'; return false">
        <pre>
        <textarea rows="8" cols="26" id="ta" name="ta">
        </pre>
      </body>
    </html>This works fine but the file that I am reading is a log file so it changes frequently. The problem I am having is that as the text file changes each subsequent ajax request to the file results in the original contents of the text file and not the new updated (appended) contents of the text file.
    Even after many many ajax requests still the original contents. As you can see I have done all I can to prevent caching(that I know of). If I close the browser and relaunch I get the most current version of the text file.
    I am using netbeans 5 and the built in version of tomcat. Is there a setting in the server.conf file that will prevent caching? Is there something in the code that is wrong?
    I am at wits end with this problem so any advice is greatly appreciated.
    TIA!

    I have it partially figured out.
    This is just temporary (afa the refresh goes), in the future I will use ajax to pull the data without a refresh.
    The problem was here:
    xmlObj.send (' ');//I had this
    xmlObj.send (false);//I needed this.The problem I have now is:
    I have an event handler that resides in
    (project is called agi)
    C:\Documents and Settings\gforte\agi\src\java\agi\EventHandler.java
    which writes to the log file here:
    C:\Documents and Settings\gforte\agi\web\logger\Jan26EventLog.txt
    The code on my ajax call that sets the file to read is:
    <body onload="ajaxRead('./logger/Jan26EventLog.txt')//calls the ajax function and sets the path to the fileThe page is actually reading the file here:
    C:\Documents and Settings\gforte\agi\build\web\logger\Jan26EventLog.txt
    which is not updated , or perhaps updated but not frequently enough.
    So how do I :
    1. read from the build directory path
    2.write to a different location and read from that location
    3. some other suggestion?
    I tried to explicitly set the path to the desired file:
    <body onload="ajaxRead('C:\Documents and Settings\gforte\agi\build\web\logger\Jan26EventLog.txt')
    but ajax doesnt like this.
    TIA!

  • Ajax is caching the output and not updating the page.If you force a second postback after you should have seen a popup (but didn'), you then see popup displayed

    Ajax is caching the output and not updating the page.If you force a second postback after you should have seen a popup (but didn'), you then see popup displayed

    Hey, thanks for replying. It is the user who needs to manually submit the page.
    Basically our page has a hidden div with various text fields and combo boxes. When the user click on specific links on the page, this div is populated and made visible to the user in server side code.
    What happens for all other browsers other than firefox 23 onwards (worked fine in 22) is that after the user clicks on the link, our server side code is executed via a HTTP post. The server then renders the hidden div and sends the additional HTML down to the browser via ASP.NET AJAX.
    With Firefox 23, the additional HTML is not rendered on the first postback. Subsequent clicks of the same link execute the same server side code but the additional HTML is rendered on the browser without issue.
    We've done a lot of debugging now and the issue is localised to a specific third party supplier's (Infragistics) control. I think Firefox 23 must have changed the way that the viewport or screen bounds are calculated or reflected back to this control as the issue seems to stop when we remove the control's MaintainPositionOnScroll attribute. It might be that the Firefox 23 DOM is not able to provide the screen dimensions accurately when the page is first rendered. I say this as the second postback renders the additional HTML fine.
    The control in question is quite an old version so I don't think it's your issue to be honest.
    Just so that this might be helpful to other developers using the Infragistics Window Dialog Control, setting MaintainPositionOnScroll to false solved this issue for us.

  • Shuttle and AJaX

    Hello all,
    I have an interesting issue to do with population of a shuttle in 3.1 using AJaX. The session state of selected items is what's causing me dramas, details as follows:
    The left side of the shuttle is populated according to a series of cascading select lists with an optional 'filter' checkbox on each. So every time the value of a select is changed or a checkbox checked/unchecked the ajax process is fired to repopulate the list accordingly.
    My Javascript is:
    function get_ITEMS(){
    var l_Count = 0
    var l_Return = null;
    var l_Select = $x('P2_ITEMS_LEFT');
    var get = new htmldb_Get(null,$v('pFlowId'),
    'APPLICATION_PROCESS=BUILD_ITEMS_SEL',0);
    get.addParam('x01',$v('P2_PRODFILTER'));
    get.addParam('x02',$v('P2_WORKFILTER'));
    get.addParam('x03',$v('P2_COREFILTER'));
    get.addParam('x04',$v('P2_PRODUCT'));
    get.addParam('x05',$v('P2_WORK_TYPE'));
    get.addParam('x06',$v('P2_CORESYSTEM'));
    get.addParam('x07',$v('P2_DISCIPLINE'));
    gReturn = get.get('XML');
    if(gReturn && l_Select){
    l_Count = gReturn.getElementsByTagName("option").length;
    l_Select.length = 0;
    for(var k=0;k<l_Count;k++){
    var l_Opt_Xml = gReturn.getElementsByTagName("option")[k];
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    get = null;
    and the application level process BUILD_ITEMS_SEL is:
    DECLARE
    v_doprod varchar2(3);
    v_dowork varchar2(3);
    v_docore varchar2(3);
    v_prod varchar2(30);
    v_work varchar2(30);
    v_core varchar2(30);
    v_disc varchar2(30);
    BEGIN
    v_doprod := wwv_flow.g_x01;
    v_dowork := wwv_flow.g_x02;
    v_docore := wwv_flow.g_x03;
    v_prod := wwv_flow.g_x04;
    v_work := wwv_flow.g_x05;
    v_core := wwv_flow.g_x06;
    v_disc := wwv_flow.g_x07;
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<select>');
    FOR rec IN (
    SELECT distinct(item) as "ITEM"
    FROM TBL_ROVE_GRADINGS
    WHERE bus_unit = :P2_BUSUNIT
    AND discipline = v_disc
    AND ((product = v_prod or product = 'all') or v_doprod = 'No')
    AND ((work_required = v_work or work_required = 'all') or v_dowork = 'No')
    AND ((core_system like '%'||v_core||'%' or core_system = 'all') or v_docore = 'No')
    order by item asc
    LOOP
    htp.prn('<option value="' || rec."ITEM"|| '">' || rec."ITEM"|| '</option>');
    END LOOP;
    htp.prn('</select>');
    END;
    This all works perfectly well. I can change my cascading selects, select items, refilter and select other items, the AJaX does its lovely stuff and I've got beautiful process flow. I can have the right-hand side populated from multiple different left-hand lists according to filtering choices.
    The problem is when I need to have the selected items remembered in session state. If I navigate away and then return my left-side has retained its session state (it's rebuilt onload from the currently selected cascading select values) but the right-hand side is blank.
    I've got a nasty suspicion that the core of the issue is because the left side may no longer have the values that the right-side session state is looking for to mark as 'selected'.
    Essentially, what I need is a solution that will 'force' the right-side to have the values previously selected for various filtered choices in the left.
    Any thoughts?
    Thanks :D

    Hello Frank,
    >> If I navigate away and then return my left-side has retained its session state
    I’m assuming that “navigate away” means redirecting from the page (without submitting it). In this case, the session state of the page is not saved, and none of the AJAX components you are using save it either, so you are left with a session state that represent page loading time.
    The addParam() method doesn’t save state. You should use the add() method, which do set session state. For example
    get.add(' P2_PRODFILTER',$v('P2_PRODFILTER'));This will save the session state for all your select lists. Of course, you will have to change the on-demand process accordingly.
    The second thing is to handle the shuttle value. You need to remember that for the APEX engine, a shuttle value is a colon-delimited string. You should generate this value in your on-demand process, and use the APEX_UTIL.SET_SESSION_STATE procedure to save it into session state. If you anticipate that this value will include options that don’t exist on your shuttle left side (left is relative, so let’s say your source column) you should set the LOV option of “Display Extra Values” to Yes.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • How to use Ajax Get Multiple Values in Tabular form?

    Hi All-
    I am trying to use AJAX to get multiple values in tabular form by using Denes Kubicek's example in the following link -
    http://apex.oracle.com/pls/otn/f?p=31517:239:9172467565606::NO:::
    Basically, I want to use the drop down list to populate rest of the values on the form.
    I have created the example(Ajax Get Multiple Values, application 54522) on Oracle site -
    http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::
    Workspace: iConnect
    login: demo
    password: demo
    I was able to duplicate his example on page 1 (home page).
    However, I want to use system generate tabular form to finish this example, and was not able to populate the data correctly.
    Page 2 (method 2) is the one that I am having trouble to populate the column values. When I checked application item values in Session, and the values seems to be populated correctly.
    This is what I have done on this page:
    1. Create an Application Process On Demand - Set_Multi_Items_Tabular2:
    DECLARE
      v_subject my_book_store.subject%TYPE;
      v_price my_book_store.price%TYPE;
      v_author my_book_store.author%TYPE;
      v_qty NUMBER;
      CURSOR cur_c
      IS
      SELECT subject, price, author, 1 qty
      FROM my_book_store
      WHERE book_id = :temporary_application_item2;
    BEGIN
      FOR c IN cur_c
      LOOP
      v_subject := c.subject;
      v_price := c.price;
      v_author := c.author;
      v_qty := c.qty;
      END LOOP;
      OWA_UTIL.mime_header ('text/xml', FALSE);
      HTP.p ('Cache-Control: no-cache');
      HTP.p ('Pragma: no-cache');
      OWA_UTIL.http_header_close;
      HTP.prn ('<body>');
      HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
      HTP.prn ('<item id="f04_' || :t_rownum || '">' || v_subject || '</item>');
      HTP.prn ('<item id="f05_' || :t_rownum || '">' || v_price || '</item>');
      HTP.prn ('<item id="f06_' || :t_rownum || '">' || v_author || '</item>');
      HTP.prn ('<item id="f07_' || :t_rownum || '">' || v_qty || '</item>');
      HTP.prn ('</body>');
    END;
    2. Create two application items - TEMPORARY_APPLICATION_ITEM2, T_ROWNUM2
    3. Put the following in the Page Header:
    <script language="JavaScript" type="text/javascript">
    function f_set_multi_items_tabular2(pValue, pRow){
        var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=Set_Multi_Items_Tabular2',0);
    if(pValue){
    get.add('TEMPORARY_APPLICATION_ITEM2',pValue)
    get.add('T_ROWNUM2',pRow)
    }else{
    get.add('TEMPORARY_APPLICATION_ITEM2','null')
        gReturn = get.get('XML');
        if(gReturn){
            var l_Count = gReturn.getElementsByTagName("item").length;
            for(var i = 0;i<l_Count;i++){
                var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
                var l_ID = l_Opt_Xml.getAttribute('id');
                var l_El = html_GetElement(l_ID);   
                if(l_Opt_Xml.firstChild){
                    var l_Value = l_Opt_Xml.firstChild.nodeValue;
                }else{
                    var l_Value = '';
                if(l_El){
                    if(l_El.tagName == 'INPUT'){
                        l_El.value = l_Value;
                    }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
                        l_El.parentNode.innerHTML = l_Value;
                        l_El.parentNode.id = l_ID;
                    }else{
                        l_El.innerHTML = l_Value;
        get = null;
    </script>
    Add the follwing to the end of the above JavaScript:
    <script language="JavaScript" type="text/javascript">
    function setLOV(filter, list2)
    var s = filter.id;
    var item = s.substring(3,8);
    var field2 = list2 + item;
    f_set_multi_items_tabular2(filter, field2);
    4. Tabular form query:
    select
    "BOOK_ID",
    "BOOK",
    "SUBJECT",
    "PRICE",
    "AUTHOR",
    "QTY",
    "BOOK_ID" BOOK_ID_DISPLAY
    from "#OWNER#"."MY_BOOK_STORE"
    5. In Book_ID_DISPLAY column attribute:
    Add the following code to element attributes: onchange="javascript:f_set_multi_items_tabular2(this.value,'#ROWNUM#');"
    Changed to -> onchange="javascript:setLOV(this,'f03');"
    Now,  T_ROWNUM2 returns value as f03_0001. But, TEMPORARY_APPLICATION_ITEM2 returns as [object HTMLSelectElement]...
    Please help me to see how I can populate the data with this tabular form format. Thanks a lot in advanced!!!
    Ling
    Updated code in Red..

    Ling
    Lets start with looking at what the javascript code is doing.
    function f_set_multi_items_tabular(pValue, pRow){
      /*This will initiate the url for the demand process to run*/
      var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
                              'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
      if(pValue){
        /*If there is an value than submit item name with value*/
        get.add('TEMPORARY_APPLICATION_ITEM',pValue)
        get.add('T_ROWNUM',pRow)
      }else{
        /*Else set the item TEMPORARY_APPLICATION_ITEM to null*/
        get.add('TEMPORARY_APPLICATION_ITEM','null')
      /*Submit the url and te returned document is of type XML*/
      gReturn = get.get('XML');
      if(gReturn){
        /*There is something returned*/
        var l_Count = gReturn.getElementsByTagName("item").length;
        /*For all elements of the tag item*/
        for(var i = 0;i<l_Count;i++){
          /*Get the item out of the XML*/
          var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
          /*Get the id of the item*/
          var l_ID = l_Opt_Xml.getAttribute('id');
          /*Get the element in the original page with the same id as
          **the item we have in the XML produced by the ondemand process
          var l_El = html_GetElement(l_ID);
          /*Now get the value of the item form the XML*/
          if(l_Opt_Xml.firstChild){
            var l_Value = l_Opt_Xml.firstChild.nodeValue;
          }else{
            /*There is no value*/
            var l_Value = '';
          if(l_El){
            /*There is an element with the same id as the item we are processing*/
            if(l_El.tagName == 'INPUT'){
              /*The element is an input item just set the value*/
              l_El.value = l_Value;
            }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
              /*If it is a span elment and has the class grabber
              **Then set the innerHTML of the parent to the value
              **and the id of the parent to the id
              l_El.parentNode.innerHTML = l_Value;
              l_El.parentNode.id = l_ID;
            }else{
              /*Else set the value as innerHTML*/
              l_El.innerHTML = l_Value;
      get = null;
    Now where it went wrong in your initial post
    The XML that was returned by your XML process would be something like
    <body>
      <desc>this xml genericly sets multiple items</desc>
      <item id="f02_1">CSS Mastery</item>
      <item id="f03_1">22</item>
      <item id="f04_1">Andy Budd</item>
      <item id="f05_1">1</item>
    </body>
    When you don't use apex_item to create your tabular form a item in the table will look like
    <input id="f02_0001" type="text" value="CSS Mastery" maxlength="2000" size="16" name="f05" autocomplete="off">
    Notice the id's f02_1 and f02_0001 don't match.
    So to make it work the XML would have to look like
    <body>
      <desc>this xml genericly sets multiple items</desc>
      <item id="f02_0001">CSS Mastery</item>
      <item id="f03_0001">22</item>
      <item id="f04_0001">Andy Budd</item>
      <item id="f05_0001">1</item>
    </body>
    To do that simply use lpad in the ondemand process like
    HTP.prn ('<item id="f02_' || lpad(:t_rownum,4,'0') || '">' || v_subject || '</item>');
    HTP.prn ('<item id="f03_' || lpad(:t_rownum,4,'0') || '">' || v_price || '</item>');
    HTP.prn ('<item id="f04_' || lpad(:t_rownum,4,'0') || '">' || v_author || '</item>');
    HTP.prn ('<item id="f05_' || lpad(:t_rownum,4,'0') || '">' || v_qty || '</item>');
    Keep in mind that the above is based on your original post and #ROWNUM# not being lpadded with zero's.
    Nicolette

  • Values having html tags not getting populated while using AJAX in APEX

    Hi,
    I am using AJAX to populate certain values in a tabular report.
    I have a java script of this form (I have taken this example from Denes's example http://apex.oracle.com/pls/otn/f?p=31517:241:1400877312570049)
    <script language="JavaScript" type="text/javascript">
    function f_set_multi_items_tabular(pValue, pRow){
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
    if(pValue){
    get.add('TEMPORARY_APPLICATION_ITEM',pValue)
    get.add('T_ROWNUM',pRow)
    }else{
    get.add('TEMPORARY_APPLICATION_ITEM','null')
    gReturn = get.get('XML');
    if(gReturn){
    var l_Count = gReturn.getElementsByTagName("item").length;
    for(var i = 0;i<l_Count;i++){
    var l_Opt_Xml = gReturn.getElementsByTagName("item");
    var l_ID = l_Opt_Xml.getAttribute('id');
    var l_El = html_GetElement(l_ID);
    if(l_Opt_Xml.firstChild){
    var l_Value = l_Opt_Xml.firstChild.nodeValue;
    }else{
    var l_Value = '';
    if(l_El){
    if(l_El.tagName == 'INPUT'){
    l_El.value = l_Value;
    }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
    l_El.parentNode.innerHTML = l_Value;
    l_El.parentNode.id = l_ID;
    }else{
    l_El.innerHTML = l_Value;
    get = null;
    </script>
    And I have the application process as follows
    BEGIN
    OWA_UTIL.mime_header ('text/xml', FALSE);
    HTP.p ('Cache-Control: no-cache');
    HTP.p ('Pragma: no-cache');
    OWA_UTIL.http_header_close;
    HTP.prn ('<body>');
    HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
    HTP.prn ('<item id="f05_000' || :T_ROWNUM || '">' || :TEMPORARY_APPLICATION_ITEM || '</item>');
    HTP.prn ('</body>');
    END;
    If I have :TEMPORARY_APPLICATION_ITEM as 'Vikas' it gets displayed properly but if I have '&lt;b&gt;Vikas&lt;b&gt;' it shows null. if it has any HTML tags function l_Opt_Xml.firstChild.nodeValue is not working properly .Please tell me what modiifcation can I use in function l_Opt_Xml.firstChild.nodeValue to get Values with HTML tags also to get displayed.
    Thanks,
    Vikas

    Vikas,
    Try escaping special characters: htf.escape_sc(:TEMPORARY_APPLICATION_ITEM)Regards,
    Dan

  • Ajax logic is not working correctly

    Hello,
    I am very beginner in JavaScript and don't know how to troubleshoot this.
    The last logic where it says if(response == 0), else....doesn't work. whatever the result of my query is it will return as else.
    I found this code from the page below:
    http://woork.blogspot.com/2007/10/login-using-ajax-and-coldfusion.html
    What I need to do here is if response is not equal to 0 then send user to page window.location='pagexyz.cfm'; and else go to a different page.
    Thanks in advanced
    <script type="text/javascript" language="JavaScript">
       <cfoutput>
    /* XMLHTTPRequest Enable */
    function createObject() {
    var request_type;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
    request_type = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
    request_type = new XMLHttpRequest();
    return request_type;
    var http = createObject();
    /* LOGIN */
    /* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
    var nocache = 0;
    function login() {
    // Optional: Show a waiting message in the layer with ID ajax_response
    document.getElementById('login_response').innerHTML = "Loading..."
    // Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
    var email = encodeURI(document.getElementById('emailLogin').value);
    var psw = encodeURI(document.getElementById('pswLogin').value);
    // Set te random number to add to URL request
    nocache = Math.random();
    // Pass the login variables like URL variable
    http.open('get', 'includes/loginquery.cfm?email='+email+'&psw='+psw+'&nocache = '+nocache);
    http.onreadystatechange = loginReply;
    http.send(null);
    function loginReply() {
    if(http.readyState == 4){
    var response = http.responseText;
    if(response == 0){
    // if login failsa
    document.getElementById('login_response').innerHTML = 'Login failed! Verify user and password';
    // else if login is ok show a message: "Welcome + the user name".
    } else {
    document.getElementById('login_response').innerHTML = response;
    window.location='#eqSiteRoot#member/index.cfm';
      </cfoutput>

    I installed firefox with the add-on you recommended but unfortunetly I am not good with debuging javascript so it didn't help me. Below I attached my current code (I also tried not including any dynamic variables but didn't help).
    <!-- Include AJAX Framework -->
    <script type="text/javascript" language="JavaScript">
       <cfoutput>
    /* XMLHTTPRequest Enable */
    function createObject() {
    var request_type;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
    request_type = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
    request_type = new XMLHttpRequest();
    return request_type;
    var http = createObject();
    /* LOGIN */
    /* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
    var nocache = 0;
    function login() {
    // Optional: Show a waiting message in the layer with ID ajax_response
    document.getElementById('login_response').innerHTML = "Loading..."
    // Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
    var email = encodeURI(document.getElementById('emailLogin').value);
    var psw = encodeURI(document.getElementById('pswLogin').value);
    // Set te random number to add to URL request
    nocache = Math.random();
    // Pass the login variables like URL variable
    http.open('get', '#eqSiteRoot#includes/loginquery.cfm?email='+email+'&psw='+psw+'&nocache = '+nocache);
    http.onreadystatechange = loginReply;
    http.send(null);
    function loginReply() {
    if(http.readyState == 4){
    var response = http.responseText;
    if(response == 0){
    // if login failsa
    document.getElementById('login_response').innerHTML = 'Login failed! Verify user and password';
    // else if login is ok show a message: "Welcome + the user name".
    } else {
    document.getElementById('login_response').innerHTML = response;
    window.location='#eqSiteRoot#member/index.cfm';
      </cfoutput>
    </script>
    <!-- Form: the action="javascript:login()"call the javascript function "login" into ajax_framework.js -->
    <form action="javascript:login()" method="post">
    <table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr>
      <td align="right"> </td>
      <td width="150" align="right">Forgot your password?</td>
      <td width="55" align="right"> </td>
      <td width="15" align="right"> </td>
    </tr>
    <tr>
    <!---onFocus="if(this.value=='Email')this.value='';" value="Email"--->
    <!--- onFocus="if(this.value=='Password')this.value='';" value="Password" --->
      <td align="right"><input type="text" name="emailLogin" id="emailLogin" value=""/></td>
      <td align="right"><input type="password" name="pswLogin" id="pswLogin" value=""/></td>
      <td align="right"><input type="submit" name="Submit" value="Login" /></td>
      <td align="right"> </td>
    </tr>
    <tr>
      <td colspan="2" align="right"><!-- Show Message for AJAX response -->
    <div id="login_response"></div>
    </td>
      <td align="right"> </td>
      <td align="right"> </td>
    </tr>
    </table>
    </form>

  • Is there any way of storing audio- / video-elements in the browser cache in Safari in iOS?

    Hi there,
    I'm desperatly trying to find a solution for a web application that has to run on an iOS-Safari (e.g. on iPad, iPad2 and iPhone 4):
    It's a web-application I wrote some time ago which lets the user search for and listen to short music samples (MP3s, all from ~100 kB to ~1.5 MB). The audio player is Flash-based, so it doesn't work on iOS-devices at the moment and I'll have to implement an alternative either in HTML 5 or with a "direct" QuickTime-object.
    Both my HTML 5- and QuickTime-alternatives for iOS-devices work fine so far, but there's one major problem I can't find a solution to:
    Unlike Flash and most HTML 5-capable browsers on Windows Safari on my iPad 2 won't store the audiofiles in the browsercache after loading and playing them - neither with HTML 5 audio-tags nor with a QuickTime-Object. Every time I load an audio file for playback from the server (with JavaScript-Commands, so without changing or reloading the whole page) it's downloaded again completely.
    If a user listens to sample A and then to sample B, Safari forgot about having played sample A and downloads the whole MP3 again if I like to listen to it again. On a mobile device with a potentially narrow bandwith this behaviour is out of the question.
    Is there a way of storing downloaded audiofiles opened by HTML 5 or QuickTime in Safari's cache so it remembers already having downloaded them  -  like it caches usual "web-files" like HTML, CSS or JPEG-images, or like Flash stores such objects in its local cache?
    The Application Cache with a manifest-file is not an option - this only seems to work if the browser is offline, for example if the iOS-device is in "Airplane"-Mode.

    Yes, I watched it. It contains interesting stuff I have to admit I didn't know yet, but unfortunately I still can't find a solution to my problem:
    My first attempt was trying to use the Application Cache with a manifest file - although this is not really the intended purpose for my application... I don't have a static set of files that I want to have cached or "available offline"  -  I just want to cache MP3s which the user has played yet.
    It should be possible to use a "dynamic manifest": One that is parsed by the Apache PHP module and listing the files played so far from a PHP session - something like this:
    <?php
    session_start();
    header("Content-Type: text/cache-manifest, charset=UTF-8");
    echo "CACHE MANIFEST\n";
    foreach($_SESSION['playedSongs'] as $song)
        echo $song."\n";
    ?>
    So whenever a song is loaded / played, I could access the PHP session with AJAX, insert the filename of the played file and manually update the manifest by calling window.applicationCache.update().
    There are two problems with this:
    First of all: It doesn't work. And I didn't even get to the point of trying to use a dynamic manifest:
    <!DOCTYPE html>   
    <html manifest="cache.manifest">
        <head>
            <title>Test</title>
            <script type="text/javascript">
            function playStuff(id)
                if(id == 1)
                    window.document.getElementById("audio").innerHTML = '<audio controls preload="automatic" autobuffer><source src="song01.mp3" type="audio/mp3" /></audio>';
                else if(id == 2)
                    window.document.getElementById("audio").innerHTML = '<audio controls preload="automatic" autobuffer><source src="song02.mp3" type="audio/mp3" /></audio>';
            </script>
        </head>
        <body>
            <div id="audio"></div><br />
            <br />
            <input type="button" value="playStuff(1)" onclick="playStuff(1)" />
            <input type="button" value="playStuff(2)" onclick="playStuff(2)" />
        </body>
    </html>
    The cache.manifest looks like this:
    CACHE MANIFEST
    song01.mp3
    song02.mp3
    and is properly returned from Apache as "text/cache-manifest" by adding
    AddType text/cache-manifest manifest
    to the .htaccess of this directory.
    The Apache-logs clearly show that the Safari (respectively "AppleCoreMedia") doesn't care about the application cache when it comes to audio-files:
    Safari itself seems to acknowledge the manifest and indeed preload the files:
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/index2.html HTTP/1.1" 200 2619 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/cache.manifest HTTP/1.1" 200 79 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/cache.manifest?%3E HTTP/1.1" 200 79 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/song02.mp3 HTTP/1.1" 200 120525 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/song01.mp3 HTTP/1.1" 200 120525 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    Up to this point I did nothing but opening my test-application in Safari.
    Playing song01.mp3:
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:29 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:29 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song2.mp3:
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:05 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:05 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song1.mp3 again:
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:40 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:40 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song2.mp3 again:
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:13 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:13 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Every file is downloaded again completely when playing it. So "AppleCoreMedia" (whatever this may be exactly, the QuickTime-plugin that is triggered by the HTML 5 audio-element I suppose?) either doesn't have access to the Application Cache or simply just doesn't realize the files in it. So if I switch my iPad to "Airplane Mode" now, the Safari is unable to access / load / play the files.
    I also tried using a QuickTime-object instead of an HTML 5 audio-tag (as far as I know HTML 5 audio and video in Safari always use QuickTime?) and controlling it with something like:
    document.movie1.SetURL('song02.mp3');
    Nothing changes, it's just like using HTML 5 audio and everything gets downloaded again when loading/playing it.
    And even if this would work there'd still be a problem:
    To properly implement that I would have to load the MP3-file in the Application Cache before playing it. When doing this it seems impossible to show a "real" progress: The ProgressEvent that is fired from the Application Cache after updating it doesn't seem to provide any information about data loaded so far and the complete size of a file. It's just "File 1 from 2" and so on, and not a "real" progress where I could determine something like: "100 kB of 1.2 MB loaded" as I can with the audio-element.
    All the other storage-approaches like Web SQL / Web Database or Local Storage are no help either:
    I don't see any way of getting the MP3 data into Local Storage or Web Database or getting it out again to play it. The HTML 5 Canvas-element has a toDataURL()-function to produce a Base64-encoded representation and use it for storage  -  the Audio-element doesn't seem to have anything like this.
    My last really "dirty" approach was trying to load "manually" Base64-encoded-MP3s with a combination of AJAX and PHP: A PHP-script outputs a Base64-representation of a MP3-file and is loaded by AJAX, so I could store the Base64-representation e.g. as Local Storage or in Web Database:
    <?php
    $infile = 'song01.mp3';
    $contents = file_get_contents($infile);
    $base64 = base64_encode($contents);
    $audio = 'data:audio/mp3;base64,'.$base64.'';
    echo $audio;
    ?>
    I tried using the resulting AJAX responseText as the source-argument in an audio-source-tag. Suprise: It doesn't work in Safari on my iPad 2, the player just fails to load the "file", although this works fine in Chrome on Windows. Possibly a size limitation for Base64-URIs on Safari / iOS.
    And again: Even if this was working in iOS/Safari I don't know of a way to determine a real progress from an AJAX-query...
    The last thing I could think of is not replacing the audio- or source-tags when loading a song but leaving them in the DOM-structure, check if it's already there when a song is loaded and just add a new audio-tag if a song hasn't been loaded yet.
    This solution would be my last resort: I'd have to rewrite nearly the whole application to completely operate on JavaScript / AJAX to stay on one site in the browser - else the "cached" audio data would be lost again when changing to another site in Safari.
    Furthermore I think there'll be a small cache limit somewhere when doing this?
    Any ideas?

  • Ajax problem in IE7 - get.get() is empty

    I am testing Ajax under Mozilla Firefox and IE7. Under Firefox is everything fine but IE7 gives me errors.
    My process is the following:
    declare
    l_counter number;
    l_o_name varchar2(2000);
    begin
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<select>');
    htp.prn('<option value="x">x</option>');
    htp.prn('</select>');
    debug.add('ok');
    end;
    debug_add('ok') adds text 'ok' into debugging table. I can see that this info is being inserted into the table, so the process runs through.
    My JavaScript is in ApEx page attributes "HTML header" section and is like the following:
    <script type="text/javascript">
    function get_AJAX_SELECT_XML(pThis,pSelect){
         var l_Return = null;
         var l_Select = html_GetElement(pSelect);
         var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=my_proc',0);
         get.add('GTEST',pThis.value);
    alert(get.get());
         gReturn = get.get('XML');
         if(gReturn && l_Select){
    alert('Never here in IE7');
              var l_Count = gReturn.getElementsByTagName("option").length;
              l_Select.length = 0;
              for(var i=0;i<l_Count;i++){
                   var l_Opt_Xml = gReturn.getElementsByTagName("option");
                   appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
         get = null;
    function appendToSelect(pSelect, pValue, pContent) {
    var l_Opt = document.createElement("option");
    l_Opt.value = pValue;
         if(document.all){/* why is ie different ask bill */
              pSelect.options.add(l_Opt);
              l_Opt.innerText = pContent;
         }else{
              l_Opt.appendChild(document.createTextNode(pContent));
              pSelect.appendChild(l_Opt);
    </script>
    alert(get.get()); gives me popup with text "undefined" in IE.
    So "if(gReturn && l_Select)" will never become true.
    I call it in an item:
    onchange="get_AJAX_SELECT_XML(this,'P3201_XXX')"
    In Mozilla 2.0.0.7 everything works, i can get correct answer from get.get() and the list is being filled with "x".

    Hi,
    I'm having a sporatic problem.
    Where do you put the encoding?
    Content-type: text/xml; charset=UTF-8
    Cache-Control: no-cache
    Pragma: no-cache
    <?xml version="1.0" encoding="UTF-8"?>
    I have the following in my ODP function
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    then I start my select list:
         htp.prn('<select>');
         htp.prn(ls_default);
    and a loop to build the option code

  • Ajax Autocomplete Tabular does not work using apex_item.text in SQL Query.

    Hello,
    Is it possible to use the search function which is used in, Dennis Kubicek example, ENAME topic Ajax Autocomplete Tabular
    in a sql query using apex_items?
    Query line :
    , apex_item.text(17,xp.part_nr,null,null,'onfocus="f_register(this);" autocomplete="off"') PART
    At first I followed the example by adding 'onfocus="f_register(this);" autocomplete="off" in the element attributes in the report field.
    This didn't work... so tried to add the it in the attirbutes parameter of the apex_item.
    But this still doesn't work. No errors are given, it does not respond.
    Could somebody please help me?
    Thx!
    Astrid

    Well, I'm trying to take this one step further, but I seem to be having some difficulty.
    I'm trying to make a Filter screen to create a dynamic where clause filter screen.
    This is a page I made with Popup LOVS, just to show you my goal (now trying to use autofilters)
    http://apex.oracle.com/pls/otn/f?p=29989:5
    I have a table on my system that tells you where the field is, and I'm using that to get the table (didn't want to change the javascript, so I pass in a static value).
    This is the javascript code I used
    <pre>
    <script language="JavaScript" type="text/javascript">
    function f_register(p_this,p_name)
    var p_registered = $x('P5_ITEM_ID').value;
         var p_this_name = $x(p_this).id;
    //alert(p_this_name);
    if (p_registered != p_this_name)
    register(p_this_name, "COSTING_M", p_name, "blue", "red");
    $x('P5_ITEM_ID').value = p_this_name;
    </script>
    </pre>
    This is my query
    <pre>
    select column_name || apex_item.hidden(1,column_name) Col_name,
    apex_item.SELECT_LIST_FROM_lov(2,'=','OPERATOR') OPERATOR,
    apex_item.text (3,
    NULL,
    20,
    200,
    'onfocus="f_register(this,''' || column_name || ''');" autocomplete="off"',
    'f3_' || '#ROWNUM#',
    NULL
    ) value,column_id
    from user_tab_cols
    where table_name = 'COSTING_M'
    ORDER BY ROWNUM
    </pre>
    and here is my on-demand process
    <pre>
    declare
    TYPE CurTyp IS REF CURSOR;
    v_row varchar2(4000);
    rec CurTyp;
    V_TABLENAME NKW.UTFIELD_M.TABLE_NAME%TYPE;
    begin
    BEGIN
    SELECT TABLENAME INTO V_TABLENAME
    FROM NKW.UTFIELD_M
    WHERE FIELD_NAME = :TF_SL_COLUMN;
    EXCEPTION WHEN NO_DATA_FOUND THEN RETURN; END;
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&amp;','&');
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&lt;','<');
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&gt;','>');
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&quot;','"');
    owa_util.mime_header('text/xml', FALSE);
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<rowset>');
    open rec for
    'select distinct ' || :TF_SL_COLUMN || ' ' ||
    'from NKW.' || V_TABLE_NAME || ' ' ||
    'where '||:TF_SL_COLUMN||' like :1||''%'' ' ||
    'and rownum < 100 ' ||
    'order by '||:TF_SL_COLUMN
    using :TF_SL_SEARCH;
    loop
    fetch rec into v_row;
    exit when rec%NOTFOUND;
    htp.prn('<row>' || htf.escape_sc(v_row) || '</row>');
    end loop;
    htp.prn('</rowset>');
    end;
    </PRE>
    I made some slight mods to make the table dynamic from my source table (this is to grab master files when they exist and not to when they don't).
    I get my select list, but it's blank on all fields, any suggestions?
    thanks,
    Scott

  • Eprint error creating account: Ajax submit failed: error = 403, Forbidden

    I am trying to create an eprint account. but when I hit submit I get:
    Ajax submit failed: error = 403, Forbidden
    I am running from a mac with OSX 10.8. And a new HP Photosmart 6515. The browser is Safari version 6.0.
    I've tried different namse, screen names passwords etc....
    THANKS,
    Tim
    This question was solved.
    View Solution.

    Hi there, this issue can usually be resolved by deleting your browsers cache and restarting the browser. Other forum users have confirmed that using an alternative browser type can also work (Mozilla FF and Google Chrome have both been cited).
    Try these suggestions and see how you get on.
    If my reply helped you, feel free to click on the Kudos button (hover over the "thumbs up").
    If my reply solved your problem please click on the Accepted Solution button so other Forum users may benefit from viewing the post.
    I am an HP employee.

  • Unable to log into HP ePrint . Error message "Ajax submit failed: error =403, Forbidden"

    Installed new HP 8600 Plus printer.  Attempting to log into HP ePrint with user name and password I created.  Error message "Ajax submit failed: error =403, Forbidden".  What does the error message mean and why can't I log into the HP ePrint website?
    This question was solved.
    View Solution.

    Sorry for your frustrations! What browser and browser version are you using? Are you able to clear your cache and go to www.eprintcenter.com? Any additional information you can provide will be very helpful.
    Although I am an HP employee, I am speaking for myself and not for HP

Maybe you are looking for