473,507 Members | 12,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling Javascript function returned from AJAX Response

36 New Member
Hi,

I have a Page, where i get the response through ajax.In that Page iam calling a javascript function for css purpose of the screen.
when the response is displayed ,the javascript fn is not invoked.

help me
Sep 8 '11 #1
3 1850
Dormilich
8,658 Recognized Expert Moderator Expert
post your code (in code tags)
Sep 8 '11 #2
techbytes
36 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. //to display insert page
  4.  function pageDisplay(divid,path)
  5. {
  6.   alert("divid ...."+divid);
  7.   alert("path ..."+path);
  8.   var pathvalue =document.getElementById(path).value;
  9.   alert("pathvalue ...."+pathvalue);
  10.   searchReq.open('GET','../templates/pagelayout.jsp?path='+pathvalue);
  11.   searchReq.onreadystatechange = function()
  12.             {
  13.               pageReply(divid);
  14.             };
  15.         searchReq.send(null);
  16.  
  17. }
  18.  
  19. //------------------------------------------------
  20. function pageReply(divid)
  21. {
  22.     alert("Inside the display ..."+divid)
  23.    if(searchReq.readyState == 4)
  24.    {
  25.      var ss = document.getElementById(divid);
  26.      ss.innerHTML = '';
  27.      ss.innerHTML += searchReq.responseText;
  28.      alert("Response ...."+searchReq.responseText);
  29.      ss.style.display = "block";
  30.    }
  31.  
  32. }
  33.  
  34. //pagelayout.jsp
  35.  
  36. <%@page import="java.io.File"%>
  37. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  38. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  39.    "http://www.w3.org/TR/html4/loose.dtd">
  40.  
  41. <html>
  42.  
  43.     <head>
  44.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  45.         <script language="javascript" src="/ContentManagementSystem/js/ua.js"></script>
  46.         <script language="javascript" src="/ContentManagementSystem/js/ftiens4.js"></script>
  47.           <link href="/ContentManagementSystem/css/mastersheet.css" rel="stylesheet" type="text/css" media="screen" />
  48.         <link href="/ContentManagementSystem/css/ddsmoothmenu.css" rel="stylesheet" type="text/css" media="screen" />
  49.     <link href="/ContentManagementSystem/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" />
  50.     <link href="/ContentManagementSystem/css/marketing.css" rel="stylesheet" type="text/css" media="screen" />
  51.     <link href="/ContentManagementSystem/css/dhtmllinkmenu.css" rel="stylesheet" type="text/css" media="screen" />
  52.     <link href="/ContentManagementSystem/css/staticdiv.css" rel="stylesheet" type="text/css" media="screen" />
  53.     <link href="/ContentManagementSystem/css/modal.css" rel="stylesheet" type="text/css" media="screen" />
  54.     <link href="/ContentManagementSystem/css/xCalendar.css" rel="stylesheet" type="text/css" media="screen" />
  55.     </head>
  56.     <!--Calling the Bean Class-->
  57.     <jsp:useBean id="pageLayoutBean" class="com.cmssuite.beans.PageLayoutBean"></jsp:useBean>
  58.  
  59.     <!--      Obtaining the objects based on the needs.    -->
  60.  
  61.         <%
  62.  
  63.         String loadRefresh = "N";
  64.         String xErrorMessage = "";
  65.  
  66.          if (pageLayoutBean.getRequestValue(request, "mode").equalsIgnoreCase("pagelayout")) {
  67.             System.out.println("before process");
  68.  
  69.             com.cmsapplication.utilities.ReturnObject rObject = pageLayoutBean.processFunction(request);
  70.             if (rObject.getReturnCode().equalsIgnoreCase("0"))
  71.             {
  72.                 System.out.println("Returm Code in pageLayout >>>>"+rObject.getReturnCode());
  73.               com.cmssuite.application.objects.PageLayout sessionPage = pageLayoutBean.getSessionPageObject(request);
  74.               System.out.println("Page Name in Session .."+sessionPage.getPageName());
  75.               response.sendRedirect("../templates/treeview.jsp");
  76.            //    loadRefresh = "Y";
  77.             } 
  78.             else
  79.             {
  80.                 xErrorMessage = rObject.getReturnMessage();
  81.                 System.out.println("ERROR MESSAGE::::"+xErrorMessage);
  82.             }
  83.         }
  84.         %>
  85.         <!--script for page refresh -->
  86.  
  87. <body>
  88.        <form name="pagelayout" id="pagelayout" method="post" action="../templates/pagelayout.jsp?mode=pagelayout">
  89.         <table border="0" cellpadding="3" cellspacing="3" width="100%" style="background-color:#FFFFFF;">
  90.         <tr>
  91.             <td class="titleHeader" height="25%">&nbsp;HTML Page</td>
  92.         </tr>
  93.             <td>
  94.                 <table class="table2" width="100%" cellspacing="3" cellpadding="3"  id="GettingStartedPanel">
  95.                         <tr>
  96.                            <td style="width:50%;" align="right" class="editCellInfoLabel">Page Name :</td>
  97.                             <td width="50%" align="left" class="editCellInfo">
  98.                                   <div class="ibutton_bg"><input name="PAGE.PAGE_NAME" type="text" value="" id="PAGE.PAGE_NAME" class="ib_regulartextbox" style="text-transform:capitalize;" /></div>
  99.                             </td>
  100.                         </tr>
  101.  
  102.                         <tr>
  103.                             <td style="width:50%;" align="right" class="editCellInfoLabel">Folders :</td>
  104.                             <td width="50%" align="left"  class="editCellInfo">
  105.                                 <div class="ibutton_bg"><input name="PAGE.FOLDER_NAME" type="text" value="<%=request.getParameter("path")%>" id="PAGE.FOLDER_NAME" class="ib_regulartextbox" style="text-transform:capitalize;" /></div>
  106.                             </td>
  107.                         </tr>
  108.  
  109.                         <tr>
  110.                             <td style="width:50%;" align="right" class="editCellInfoLabel">Templates :</td>
  111.                             <td style="width:50%;" align="left" class="editCellInfo">
  112.                                 <select class="selectfield" name="PAGE.TEMPLATE_NAME" id="PAGE.TEMPLATE_NAME" style="width:154px;" onchange="layoutDisplay('template_display',this.options[this.selectedIndex].value)" >
  113.                                     <option value ="">select</option>
  114.                                     <option value ="layout1.jsp">layout1</option>
  115.                                     <option value ="layout2.jsp">layout2</option>
  116.                                     <option value ="layout3.jsp">layout3</option>
  117.                                     <option value ="layout4.jsp">layout4</option>
  118.                                 </select>
  119.                             </td>
  120.                         </tr>
  121.  
  122.                          <tr>
  123.                             <td style="width:50%;" align="right" class="editCellInfoLabel">Sample Layout :</td>
  124.                             <td align="left">
  125.                             <div class="template_display" align="center" id="template_display">
  126.                             </div>
  127.                             <td>
  128.                         </tr>
  129.  
  130.                          <tr><td colspan="4" style="width:100%;" align="left"><img border="0" src="/ContentManagementSystem/images/spacer.gif" width="1" height="5"></td></tr>
  131.                           <tr>
  132.                             <td style="width:100%;" colspan="4" align="center" valign="middle">
  133.                                     <span class="box">
  134.                                             <button id="btn_refresh" class="icon" onclick="submitForm('pagelayout');return false;"> <img class="icon" src="/ContentManagementSystem/images/moveright.jpg"/>Next</button>
  135.                                       </span>
  136.                             </td>
  137.                         </tr>
  138.                 </table>
  139.         </table>
  140.        </form>
  141.     </body>
  142.  </html>
  143.  
  144.  
  145.  
  146.  
  147.  
Sep 8 '11 #3
Dormilich
8,658 Recognized Expert Moderator Expert
what display style has this element before you run the AJAX?

I don’t see any call to pageDisplay() either.

PS. it would be more helpful if you posted the client side code (as seen by the browser) as for JavaScript any server-side code is irrelevant
Sep 8 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
51476
by: Krishna | last post by:
Hi all, Can i call my javascript functions from the web controls.Any appropriate site which will be tell more on this will be helpfull. Regards.., Krishna
6
751
by: szabelin | last post by:
Hello, I am trying to call a function inside the javascript block from asp.net during the postback (NOT button's OnClick event handler though). The javascript function creates new popup window. I...
4
6298
by: Martin Feuersteiner | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB...
1
8703
by: lwhitb1 | last post by:
I have been trying to load a javascript function from the body onload html tag, but I only want the function to load the first time the page is loaded: I have investigated but haven't found...
4
3820
by: Nathan Sokalski | last post by:
I am a beginner with AJAX, and have managed to learn how to use it when passing single parameters, but I want to return more than one value to the client-side JavaScript function that displays it....
0
1620
by: ajitgoel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
1
1737
by: Larry | last post by:
Anyone have an example of a webuser control with a checkbox that passes information to a JavaScript function on the same page? on the page I have a checkbox and a textbox (both are server...
2
2504
by: FrogBunz | last post by:
Is there a way to execute inline javascript code from within an AJAX response? I use AJAX to retrive a JSP page that is loaded using a database bean. One of the form elements is a select that I...
1
1691
by: archcool | last post by:
hi iam new to php and i need help in my php file i have written php code and as well javascript code.the php code displays a form and i need to validate the fields present in the form calling a...
8
3588
by: pankaj17 | last post by:
hello, Is it possible to communicate with another domain javascript function using ajax. Suppose i have a iframe and domain is different and in the iframe i have some links. If user clicks on...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.