Welcome to CompShack!
CompShack is a user driven Dev2Dev IT community. Developers can ask questions, help answer questions, or just browse code and articles contributed by users. No registration required.
You can register if you want to contribute code samples, share your knowledge at your own blog, and become adored in the community!

Contribute!

Contribute!Do you find yourself with few minutes to spare, and a desire to help other CompShackers?

Submit a tip, code or an SQL snippet. Start an article about topics you are familier with, or edit a Wiki page. Help the community grow larger by sharing a little bit of what you know!

Reasons why this is great:

  • You help your fellow CompShackers
  • Give back to the community and help it grow
  • Easy access to your code any time you need it
  • Become known and adored in the community!

Note: Registration required. Guests can edit Wiki pages.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

AJAX XML - The JavaScript code

AJAX is used for interactive communication with an XML file. Website may provide information from an XML file using AJAX search technology, if you select an item in a list box.

Select a CD:

TITLE: One night only
ARTIST: Bee Gees
COUNTRY: UK
COMPANY: Polydor
PRICE: 10.90
YEAR: 1998

This is the JavaScript code stored in the file "selectcd.js":

[code]
var xmlhttp
function showCD(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="getcd.php";

AJAX XML - The PHP Page code

AJAX can be used for interactive communication with an XML file. A web page can fetch information from an XML file with AJAX technology, e.g when you select an item from a dropdown box.

TITLE: One night only
ARTIST: Bee Gees
COUNTRY: UK
COMPANY: Polydor
PRICE: 10.90
YEAR: 1998

The PHP script loads an XML document, "cd_catalog.xml", runs a query against the XML file, and returns the result as HTML:

[code]

<?php
$q=$_GET["q"];
$xmlDoc = new DOMDocument();
$xmlDoc->load("cd_catalog.xml");
$x=$xmlDoc->getElementsByTagName('ARTIST');

Peoplecode Trace in a File.

Local File &fle;
&fle = GetFile(GetCwd() | "/files/Test.xml", "W", %FilePath_Absolute);
&fle.WriteLine("Hi");
&fle.Close();

Test.xml can Found in...

Web Server: psoft > appserv > DATABASENAME > files > Test.xml