473,772 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Ajax script concering parmaters in ajax.requestFil e

40 New Member
Hi all

Hope someone can help with the problem I am having as it is driving me nuts!

I have the below script on my site the problem lies with passing through a url parameter in the below line getCourseName

"ajax.requestFi le = 'getCourse.php? coursename='+ge tCourseName;"

if I change the above line to (Brackenwood being a value in my database all wors fine.

ajax.requestFil e = 'getCourse.php? coursename=Brac kenwood';

Can anyone see any problems in the below code?

My input box that I get the value from in the form has an id and name of coursename.

The script is a client lookup at dhtml goodies.

any help would be most appriciated thank you.

Tom

Expand|Select|Wrap|Line Numbers
  1.  
  2. var ajax = new sack();
  3.     var currentcoursename=false;
  4.     function getClientData()
  5.     {
  6.         var getCourseName = document.getElementById('coursename');
  7.         if(getCourseName!=currentcoursename){
  8.             currentcoursename = getCourseName
  9.             ajax.requestFile = 'getCourse.php?coursename='+getCourseName;    // Specifying which file to get
  10.             ajax.onCompletion = showClientData;    // Specify function that will be executed after file has been found
  11.             ajax.runAJAX();        // Execute AJAX function            
  12.         }
  13.  
  14.     }
  15.  
  16.     function showClientData()
  17.     {
  18.         var formObj = document.forms['calc'];    
  19.         eval(ajax.response);
  20.     }
  21.  
  22.  
  23.     function initFormEvents()
  24.     {
  25.         document.getElementById('coursename').onblur = getClientData;
  26.         document.getElementById('coursename').focus();
  27.     }
  28.  
  29.  
  30.     window.onload = initFormEvents;
  31.  
May 24 '07 #1
7 3169
acoder
16,027 Recognized Expert Moderator MVP
You need
Expand|Select|Wrap|Line Numbers
  1. getCoursename.value
getCoursename is the object - you need its value.
May 25 '07 #2
tommurray
40 New Member
You need
Expand|Select|Wrap|Line Numbers
  1. getCoursename.value
getCoursename is the object - you need its value.
Thank you for your reply I will give it ago asap, am I right in thinking where I have references to "getCoursen ame =" it should be getCoursename.v alue =

I'm new to Ajax and have only ever used Javascript very briefly.

Thanks for your help.

Tom
May 26 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Thank you for your reply I will give it ago asap, am I right in thinking where I have references to "getCoursen ame =" it should be getCoursename.v alue =
Yes, that's correct.
May 26 '07 #4
tommurray
40 New Member
Yes, that's correct.
Hi thank you for all your help I have amended all references to include the .value but still nothing works.

here is the original code from dhtml goodies

Expand|Select|Wrap|Line Numbers
  1. var ajax = new sack();
  2.     var currentClientID=false;
  3.     function getClientData()
  4.     {
  5.         var clientId = document.getElementById('clientID').value.replace(/[^0-9]/g,'');
  6.         if(clientId.length==4 && clientId!=currentClientID){
  7.             currentClientID = clientId
  8.             ajax.requestFile = 'getClient.php?getClientId='+clientId;    // Specifying which file to get
  9.             ajax.onCompletion = showClientData;    // Specify function that will be executed after file has been found
  10.             ajax.runAJAX();        // Execute AJAX function            
  11.         }
  12.  
  13.     }
  14.  
  15.     function showClientData()
  16.     {
  17.         var formObj = document.forms['clientForm'];    
  18.         eval(ajax.response);
  19.     }
  20.  
  21.  
  22.     function initFormEvents()
  23.     {
  24.         document.getElementById('clientID').onblur = getClientData;
  25.         document.getElementById('clientID').focus();
  26.     }
  27.  
  28.  
  29.     window.onload = initFormEvents;
  30.  
  31.  
I amended the following line:

Expand|Select|Wrap|Line Numbers
  1. var clientId = document.getElementById('clientID').value.replace(/[^0-9]/g,'');
so that I can use values that are not only numerical, I have also placed the .value at the end of document.getEle mentById('cours ename') but still no joy.

Thank you for your help

Regards
Tom
May 29 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
Can you post your form HTML markup.
May 29 '07 #6
tommurray
40 New Member
Can you post your form HTML markup.
Hi sorry to have bothered you I made a typo when adding the .value to the end of the ID element.

The script works now sorry for wasting your time, I have very little knowledge of JavaScript and AJAX.

Thank you for your help.
May 30 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
Hi sorry to have bothered you I made a typo when adding the .value to the end of the ID element.

The script works now sorry for wasting your time, I have very little knowledge of JavaScript and AJAX.

Thank you for your help.
No problem at all. Glad you got it working in the end.
May 30 '07 #8

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

Similar topics

1
16513
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
1
2095
by: danxavier | last post by:
I successfuly installed dd.php and sajax.php files. It runs fine, but I would like to link the $items to an image. I called the field in mysql with the link "pic". Any help would be AWESOME!!! I've run out of ideas. Here's the script <?php /* CREATE TABLE `layout` ( `set` varchar(50) NOT NULL default '', `item` varchar(50) NOT NULL default '', `order` int(9) NOT NULL default '0',
0
5576
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
10
4862
by: trpost | last post by:
I am using ajax / php where I am looking up some info from the database and populating a select list dynamically, however I am running into some sort of size limitation with the ajax.response object. If the string I am passing to javascript from php is too large javascript does not get it all the data. The magic number appears to be 6123 characters, anything below that it works fine, anything above and if I alert the ajax.response, I see...
3
1453
by: nicksname7 | last post by:
Hi, I am a newbie in the AJAX world. first of all, take a look at my script first: assume this script is saved as "myAjax.js" //-----------------inside myAjax.js-------------------- function AJAX() { var isBusy = false; var obj = null; var url = ""; var Method = "";
1
1262
Chrisjc
by: Chrisjc | last post by:
I am hoping someone can help me out here. I am trying to make one drop down box pull from a database the DB name is “dealerlocater” the column it needs to pull in this drop down is called “state” Once it loads all the states in the drop down box it then needs to be able to do the following. Once a user selects a state it will load all information listed in the ROWS of the state column I.E. ++++++++++++++++ + Select Your State + Pulls...
1
3416
by: shaunwo | last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website that I see in the comments, but no luck there), but what I already have works GREAT to populate the options in a select box. Now I'm trying to take that same code and get it to write the value to a couple input boxes. Here's a link to my ajax...
2
2786
by: shawnwperkins | last post by:
Hi Folks, I'm new to Javascript and just need a little help. I downloaded a script from Dynamic Drive's Web site and I'm trying to make a simple modification and could use some help. :) The script below fetches data from the web server and displays it in the form as a ticker on the web page. See: http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm What I would like to do is to have the Ajax ticker periodically go out
0
9620
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
10261
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...
0
10104
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
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
6715
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();...
1
4007
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
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.