473,796 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem while calling two pages which includes Js pages

254 Contributor
Hi

I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box.

Main problem is that it is not showing the editor which is called on the Get_Content.php . in Main Page.

I have included the js files in the head section.

all the files are on the same directory.

But when I am running the Get_Content.php it is showing the Editors so what is the problem

Please help me out.

I have given the codes for the pages.
Main Page which is calling the JS Page.
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script src="Get_Page.js" type="text/javascript"></script>
  3. </head>
  4. <body>
  5. <form action="insertimage.php" method="post" enctype="multipart/form-data">
  6. <table><tr>
  7.  <td valign="middle">Page Type</td>
  8.             <td align="left" valign="bottom"><select name="Page_Type" onchange="getPage(this.value)">
  9.               <option>--Select One--</option>
  10.               <option value="image">Image</option>
  11.               <option value="content">Text</option>
  12. </td></tr>></table>
  13. </form>
  14. </body>

Expand|Select|Wrap|Line Numbers
  1. //js page
  2.  
  3. var xmlHttp
  4. function getPage(str)
  5.  
  6.     xmlHttp=GetXmlHttpObject()
  7.     if (xmlHttp==null)
  8.      {
  9.          alert ("Browser does not support HTTP Request");
  10.          return;
  11.      }
  12.      var image="image";
  13.     if(str==image)
  14.     {
  15.     var url="Get_Page.php";
  16.     url=url+"?q="+str;
  17.     url=url+"&sid="+Math.random();
  18.     xmlHttp.onreadystatechange=stateChanged ;
  19.     xmlHttp.open("GET",url,true);
  20.     xmlHttp.send(null);
  21.     }
  22.     else
  23.     {
  24.     var url="Get_Content.php";
  25.     url=url+"?q="+str;
  26.     url=url+"&sid="+Math.random();
  27.     xmlHttp.onreadystatechange=stateChanged ;
  28.     xmlHttp.open("GET",url,true);
  29.     xmlHttp.send(null);
  30.     }
  31.  
  32. }
  33. function stateChanged() 
  34.     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  35.      { 
  36.          document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
  37.      } 
  38. }
  39. function GetXmlHttpObject()
  40. {
  41.     var xmlHttp=null;
  42.     try
  43.      {
  44.          xmlHttp=new XMLHttpRequest();
  45.      }
  46.     catch (e)
  47.      {
  48.          try
  49.           {
  50.               xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  51.           }
  52.          catch (e)
  53.           {
  54.               xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  55.           }
  56.       }
  57.     return xmlHttp;
  58. }
  59.  
Expand|Select|Wrap|Line Numbers
  1. //Get_Page.php
  2. <table>
  3. <tr valign="bottom">
  4.         <td width="20%" align="left" valign="middle">Caption1</td>
  5.         <td width="17%" align="left" valign="middle"><input name="Image_Name1" type="text" id="Image_Name" value="" size="15" /></td>
  6.         <td width="18%" align="center" valign="middle">File1: </td>
  7.         <td width="45%" align="left" valign="middle"><input name="File1" type="file" id="File1" value="" size="15" /></td>
  8.       </tr>
  9. <tr>
  10.         <td height="26" align="left" valign="middle">&nbsp;</td>
  11.         <td height="26" colspan="2" align="left" valign="bottom"><input type="submit" name="Upload" value="Upload"/>
  12.             <input type="reset" name="Reset" /></td>
  13.       </tr>
  14. </table>
  15.  
Expand|Select|Wrap|Line Numbers
  1. //Get_Content.php
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <script language="javascript" src="wysiwyg.js"></script>
  6. <title>Untitled Document</title>
  7. </head>
  8. <body>
  9.  
  10.     <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  11.       <tr align="left">
  12.         <td width="14%" align="left" valign="middle">&nbsp;&nbsp;&nbsp;&nbsp;Content Id </td>
  13.         <td width="86%" valign="middle"><input type="text" name="Content_Id" value="" /></td>
  14.       </tr>
  15.       <tr align="left">
  16.         <td align="center" valign="middle">Content Name </td>
  17.         <td valign="middle"><input type="text" name="Content_Name" value="" /></td>
  18.       </tr>
  19.       <tr align="left">
  20.         <td align="left" valign="top">&nbsp;&nbsp;Description</td>
  21.         <td valign="middle"><textarea id="textarea2" name="Content_Description" style="height: 200px; width: 500px;">
  22.  
  23.           </textarea>
  24.              <script language="javascript1.2">
  25.                   generate_wysiwyg('textarea2');
  26.             </script> </td>
  27.       </tr>
  28.       <tr align="left">
  29.         <td valign="middle">&nbsp;</td>
  30.         <td valign="middle"><input type="submit" name="Content" value="Add Content" />
  31.           <input name="reset" type="reset" /></td>
  32.       </tr>
  33. </table>
  34. </body>
  35. // end of page.
Now Problem is that code works fine but it is not showing the editor which is included through wysiwyg.js when I am calling it from main page.

But when I am running the Get_Content.php it shows the editor.

so is there any thing that I can not call Series of Js pages. If it is then how can I do it.
Dec 18 '07 #1
47 3294
acoder
16,027 Recognized Expert Moderator MVP
Now Problem is that code works fine but it is not showing the editor which is included through wysiwyg.js when I am calling it from main page.

But when I am running the Get_Content.php it shows the editor.

so is there any thing that I can not call Series of Js pages. If it is then how can I do it.
You'll need to include the JavaScript file. Create a script object and add it to the head of the main page.
Dec 18 '07 #2
mukeshrasm
254 Contributor
You'll need to include the JavaScript file. Create a script object and add it to the head of the main page.
But I have added the Get_Page.js to the head of main page. And how a script object will be created?
Dec 19 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
But I have added the Get_Page.js to the head of main page. And how a script object will be created?
Create a script element and set the src property to the js file and then append to the head, e.g.
Expand|Select|Wrap|Line Numbers
  1. var script = document.createElement("script");
  2. script.src=theSrc; // string containing path to the JavaScript file
  3. document.getElementsByTagName("head")[0].appendChild(script);
Dec 20 '07 #4
mukeshrasm
254 Contributor
I have main form. In that form I have a dropdown box from that box I am calling two pages using ajax and page call is fired on onchange event of dropdown box.

both pages are called if there is no javacript written on either page. But when I write some javascript code the javascript is not working on main form. so what can be problem.
Dec 27 '07 #5
gits
5,390 Recognized Expert Moderator Expert
... please post the code to have a look at ...

kind regards
Dec 27 '07 #6
mukeshrasm
254 Contributor
... please post the code to have a look at ...

kind regards
Hi

I tried to put some code here but it is showing some error. So what I mean to ask is that if a page has javascript function or calls to some js page so will the functionality of javascript/js page on this page be not reflected to the main page?
If no then why it is not working here

Say you have one main page which call a js page through ajax and in turn that page calls other js page so the functionality of this page will be work on main page or not.
Dec 27 '07 #7
gits
5,390 Recognized Expert Moderator Expert
nope ... in case you call a page through ajax the scripts in there are not evaluated except you do that explicitly ... so without having a look at the code or at least the response i only could guess the problem ...

kind regards
Dec 27 '07 #8
acoder
16,027 Recognized Expert Moderator MVP
Merged your threads. Keep one problem to one thread.

See post #4.
Dec 27 '07 #9
mukeshrasm
254 Contributor
nope ... in case you call a page through ajax the scripts in there are not evaluated except you do that explicitly ... so without having a look at the code or at least the response i only could guess the problem ...

kind regards

See the post #4 for your reference.
Jan 7 '08 #10

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

Similar topics

31
3850
by: Bruce W...1 | last post by:
This is a best practices question. For a website where PHP is used, does it make sense to have both .htm and .php files? In other words, for pages that have no active content there's no point in naming them with a .php extension. Is there any advantage or disadvantage to making all files .php, or the same for mixing them with .htm files? What do you do, and why?
6
2727
by: Rob Long | last post by:
Hey, I've written a custom HTML library using many PHP scripts as seperate files (just like I'd do a java project) and I'm having some problems where I'm including scripts in different directories from already included scripts... basically where there'a an include chain spanning multiple directories. I've reduced the problem to its core:
3
1385
by: Keith | last post by:
I have a block of ASP code (enclosed in <% .. %>). How can I call that piece of code from another piece of similar code? And can the code be in any order on the page for it to work? Thanks
4
1570
by: Chad Richardson | last post by:
As I'm writing this I think I am answering my own question, but I'd like to get any other ideas on the subject as well. I have a standard Header.asp that I want to include in every other page in my site. Header.asp is located in the root folder, but the calling pages are in various folders/levels. Since the relative paths specified in header are subject to change and are based on the relative path of the calling page, problems arise....
2
4641
by: WisTex | last post by:
I've come across a very weird problem. Virtual includes work on all my ASP pages on the entire website, including those in subdirectories, yet they won't work on a particular page I created, even though the virtual include statement is copy & pasted exactly as it appears on the working pages. What would cause virtual includes to work in one page on a website, but not on another? Error Message: Microsoft VBScript runtime error...
78
4977
by: Josiah Manson | last post by:
I found that I was repeating the same couple of lines over and over in a function and decided to split those lines into a nested function after copying one too many minor changes all over. The only problem is that my little helper function doesn't work! It claims that a variable doesn't exist. If I move the variable declaration, it finds the variable, but can't change it. Declaring the variable global in the nested function doesn't work...
8
1734
by: supasnail | last post by:
I have a happily working set of asp pages which read from the database via include file "./_private/include/database.mdb". However, when I try to gain access to this database on pages one folder removed using "../_private/include/database.mdb", the pages won't display. This whole system works fine on my home test server (iis.5.0), but 'breaks' when uploaded to the public server. I know the path to database is correct because the upper...
12
8464
by: Atlas | last post by:
I'm working on a multilanguage ASP/HTML site using a IIS6 web server. It perfectly works with two languages (english and italian) in this way: - basically the same ASP code for every language - language-specific content is stored in text files, every language has it's own directory contents. - to enhance usability and formatting the language-specific contents are stored with html syntax; basically the code that normally stands between...
17
1915
by: henry | last post by:
Folks Here's a skeleton, generic HTML page, call it "index.php". You'll see a bit of php code in the middle: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
0
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9052
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4118
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 we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.