473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Why does Ajax work locally but not on server?

i've created an ajax test call that works locally, but when i upload to my hosts(2 of them) i get nothing. My sample page is: Linkage to test page.

my code is as follows:
Expand|Select|Wrap|Line Numbers
  1. function OnLookup(element)
  2.     {           
  3.       var stb = document.getElementById(element);
  4.       Encryption.Encrypt(stb.value, OnLookupComplete);
  5.     }
  6.  
  7.     function OnLookupComplete(result)
  8.     {
  9.       var res = document.getElementById("_resultLabel");
  10.       res.innerHTML = "<b>" + result['0'] + "</b>";
  11.       LoadMsgs(result['0'], result['1'], result['2']);
  12.   }
  13.  
  14.   function UnWork()
  15.   {
  16.       var msg = document.getElementById("hdMessage");
  17.       var key = document.getElementById("hdPrivateKey");
  18.       Encryption.Decrypt(msg.value, key.value, UnWorkComplete);
  19.  
  20.   }
  21.   function UnWorkComplete(response)
  22.   {
  23.  
  24.       var resX = document.getElementById("_resultLabel");
  25.       resX.innerHTML = "<b id='reda'> This is your message: " + response + "</b>";
  26.   }
  27.  
  28.     function LoadMsgs(x,y,z)
  29.     {
  30.  
  31.         // Create an Option object        
  32.         var opt = document.createElement("option");
  33.  
  34.         // Add an Option object to Drop Down/List Box
  35.         document.getElementById("lstResult1").options.add(opt);
  36.         // Assign text and value to Option object
  37.         opt.text = x;
  38.         opt.value = x;
  39.         document.getElementById("hdMessage").value = x;
  40.         // Create an Option object        
  41.         var opt = document.createElement("option");
  42.  
  43.         // Add an Option object to Drop Down/List Box
  44.         document.getElementById("lstResult2").options.add(opt);
  45.         // Assign text and value to Option object
  46.         opt.text = y;
  47.         opt.value = y;
  48.         document.getElementById("hdPrivateKey").value = y;
  49.         // Create an Option object        
  50.         var opt = document.createElement("option");
  51.  
  52.         // Add an Option object to Drop Down/List Box
  53.         document.getElementById("lstResult3").options.add(opt);
  54.         // Assign text and value to Option object
  55.         opt.text = z;
  56.         opt.value = z;
  57.     }
  58.  
  59.  
Oct 4 '10 #1
8 9232
Oralloy
988 Expert 512MB
Donald,

It's possible that your page is referencing the wrong URL to pull the JavaScript from.

Try entering the URL for your JavaScript in your browser, and see if it's being deployed correctly to you.
Oct 5 '10 #2
The script works fine. it's actually what gives you the message if you try the test page. The calls are made to a web service through a reference by the scriptmanager. the error occurs when the attempt is made to reach the webservice.
Oct 5 '10 #3
Frinavale
9,735 Expert Mod 8TB
Have you seen this article?
Client-Side Web Service Calls with AJAX Extensions

Did you set the ScriptManager's Script ServiceReference tag to point to the correct path?

For example:
Expand|Select|Wrap|Line Numbers
  1. <asp:ScriptManager ID="_scriptManager" runat="server">
  2.       <Services>
  3.         <asp:ServiceReference 
  4.              Path="services/StockQuoteService.asmx" />
  5.       </Services>
  6. </asp:ScriptManager

-Frinny
Oct 6 '10 #4
Yes, i've read that particular article. This current call is based on the example it contains.
Oct 6 '10 #5
Frinavale
9,735 Expert Mod 8TB
So what have you set as the Path attribute?
Is it correct?
Oct 6 '10 #6
After arguing with my host on four separate occasions and rewriting this page 3 times, it's been determined that the fault lies with my host, as the file not found message i was getting seemed to be referring to a namespace that i needed for my code to work.

here is the latest revision. Current Test Page with test call to script.
Oct 7 '10 #7
Frinavale
9,735 Expert Mod 8TB
Well...

I'm glad you got that sorted out but it still doesn't seem to be working properly....
Oct 7 '10 #8
godaddy still hasn't fixed it yet. According to the rep, the have to have their tech dept. develop a custom script from scratch so they can see exactly what the problem is. i linked the current test page to show that the call to the web service is properly linked and functioning.
Oct 7 '10 #9

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

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
7
by: Niels Sloth | last post by:
Hi I have 9 asp-sites on a Win2003 server, and would like to use the same include file, but it does not work. The path for the servers default website (which is not where the problem is) is...
1
by: Wendy Elizabeth | last post by:
Can you give me some suggestions of why the xml web service is not working? I have an xml web service that works in my visual studio. net 1.1 environment. I setup this project up for deployment...
6
by: Kimon Ifantidis | last post by:
Refer to my message "HELP - HELP - HELP" today. When setting the data connection, I specify "Windows authentication". I tried to create a user with full permissions and include user id and...
1
by: emilstamatoiu | last post by:
environment: a web page contains a number of pictures that are downloaded using AJAX. issue: when the web page is downloaded as a ".html " file AJAX does its job perfect. when the identical...
9
by: schmeckel | last post by:
I am trying to use some very basic AJAX functionality (update panel for partial page update) on my website. When I run my webpage in VS 2005, the partial page update works fine. However, when I...
1
by: =?Utf-8?B?c3JhbWFrcmlzaG5h?= | last post by:
Hello I have JavaScript Functions and AJAX being used in my application When I run my application using NetScape my JavaScriot or AJAX does not work? Kindly give suggestions Thank you,
5
by: Herkum | last post by:
I created this generic AJAX Handler to work with Firefox and IE. However, it seems that somewhere in updating Firefox to 2.0.0.9 that the handler assigned to onreadystatechange is no longer getting...
3
by: ajaxphp | last post by:
hello, all: I am having trouble to make ajax work for my tiny php app. I have a index.php file, which is <?PHP session_start(); $_SESSION = md5(uniqid(rand(), TRUE)); ?> <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
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
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...

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.