It is day two of the same problem (and day two of learning Ajax, day five of Javascript)
The current code (below) does nothing; it does not go into the showContents function. Switching the order of some items would cause it to enter the function, but it would always alert that the xhr status was 0. I guess this is an improvement?
php doc that is getting requested (I don't think the error is here as the problem is that it is not even initializing):
Code:
javascript code that is requesting the information:
Code:
I need to pass the num variable because the fields I am dealing with are part of a bunch of fors that create an unspecified number of fields titled 1source, 2source, 3source, etc.
I have a php page which returns a table representing a query sent to a MySQL database. So far it has worked in every case except now that I'm trying to use it to call a stored procedure, in which case the readystate is staying at 1 and never completing.
I have logged the results of the php file both in an error log and looked at the response from the request using firebug, both of which show a correct result.
Why isn't this returning properly?
Here are the relevant javascript functions:
Code: function customizeType() { $("custom-header").innerHTML = ""; $("custom-top").innerHTML = "";
[Code]....
After the page loads, the error log shows correct results for all queries.
My app recently upgraded to 1.4 and as such started using the XMLHttpRequest in the success callback of the .ajax function however we been forced to roll back to 1.3.2 due to performance issues with IE7 (forced to use in a corporate environment) Is there any way to get access to the XMLHttpRequest after an ajax call? If not, would anyone be so kind as to point out if its possible to modify the 1.3.2 source to add the parameter to the success call back like in 1.4? I am hoping its a simple modification however I could be wrong. We are set to upgrade to the lastest jQuery when we get a browser upgrade to IE9 but that could be up to a year away and I would really like to continue to use the XMLHttpRequest in my app as its a lot faster than my old approach.
I am trying to create an xmlhttprequest object to update the shopping cart on my web page without submitting the entire page to the server for processing. However, what I have done so far is not working. All that is happening when I click the "update cart" button is the page sort of flashes and the check marks in the remove item check boxes disappear. The first code snippet is the "traditional" way of submitting the whole page to the server for processing - and it works. The second snippet is what I have done to try and implement AJAX to submit only the shopping cart - and it does not work.
I am running the scripts below which should return a string containing a URL. So far, it cannot find the form contents in Firefox, but displays the non-dynamic data such as ?Location=. It won't work at all in IE.
HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
I am trying to build a very simple Ajax example with JavaScript and PHP. Basically, the goal is to populate a select list with values dependent on the selection in another list. I am able to do a GET from a server-side script and I see the XML displayed correctly in XMLHttpRequest.responseText. However, when I try to check XMLHttpRequest.responseXML, I am not able to get anything out of it. The alert() shows it as an "Object", so it's not null. I have tried getElementByTagName() from both responseXML and responseXML.documentElement, each time giving a legitimate inner tag, but nothing comes out. What is the correct way of doing it? This is my JavaScript and HTML code:
I find ajax with jquery more confusing than with regular JS, b/c in jQuery you don't declare XMLHttpRequest object.. so how do you do something like:
In example I mention here,[url] namely [url] I don't understand where var 'msg' is declared, I know it comes from the back-end, but HOW is it passed to the front-end? (how do you do this w/o responseText or something similar?)
I'm trying to connect to a send-mail jsp with ajax.. the email is not getting sent.. I want to test if the ajax connection is being made at all.. don't know how do it w/o something like xmlHttp.responseText
This is my jQuery ajax code for connecting to send-email jsp:
var dataToSend = "name=sName&email=sEmail&msg=sMsg;
i am new to AJAX but i havejust managed to write one of my first basic scripts. What it does is takes all the news items out of a database and lists them as links. When you click a link i want all of the data that is linked to that news item to display underneath. Now i have got this to work except it will not work in Firefox, all other browsers it is fine.
I was wondering if it was possible to execute javascript returned by ajax (XMLHttpRequest)? I can see that the script is returned by it doesn't execute. Here is what it returns. I can see the output but when I click on it nothing happens.
Code: <script type="text/javascript"> function hi(name){ var latBox = document.getElementById("myinfo"); latBox.innerHTML = "<div>Greetings: " + name + "</div>"; } </script> <p onClick="hi('hi');">Math.random = " + Math.random() + "</p>
I am trying to read data from server using AJAX XMLHttpRequest.responseText.In received data, there are lot of similar type of characters which has tge value of FFFFFD (65533). I think, all characters which has the value above 127 are converted to default character.
Can I use the XMLHttpRequest object to call a url which would generate a PDF and then display it to the screen?
I'm new to AJAX and I'm very interested in using it to asychronously bring back documents with a content-type that IS NOT text/plain or text/html (like a PDF or Excel document) and then display that document to the screen. I have a web application that dynamically generates PDF and Excel documents. A user may have to wait a minute for the new doc to be created and displayed to the user. I want to put an animated notice saying the doc is being generated similar to what you see when you execute a search on a search engine. I've tried using animated gifs (with frames, etc.) but they don't work. As soon as a request is sent for the PDF, the browser halts the gif in IE. If I could instead call the URL that will produce the PDF asynchronously, then I could display the animated gif and call the PDF at the same time. Once the PDF is generated, I want it to then be displayed to the screen.
document.onclick=handler; function handler(e) { //do stuff var params = "something"; var request = new XMLHttpRequest(); request.open("GET", "http://www.foo.com/bar.php?" + params, true); [Code]....
Now is user clicks something else but not a link everything works just fine. But if she clicks a link, the bar.php call does not work (never comes to the server). If I change the call to a synchronuous one request.open("GET", [URL] false) also clicking a link works fine. But I would of course prefer the async way.
I've put together a function for screen scraping, just to see if I could do it. Basically, this gets a stock quote from Yahoo! and displays it. It works with no issues in IE7. FF and Chrome, however, it does not work. It will not display anything. Error Console is not returning any errors, and I'm a total novice when it comes to troubleshooting with FireBug.
[Code]....
I'm sure it's something simple, something I've overlooked. I'm beginning to think it might be with the trenary conditional setting the method.
I'm new in Javascript and it seems I'm a bit stuck so if someone can help. The problem is 4th button / function. I dont know how to talk to the opend window, the thing with focus i wrote doesen't work so i didn't wrote code for randomizeing location (this i know how to do). Did i do something wrong?
window.opener works fine form the child window is there something similar for control from parent window? Code:
i am trying to make this code work on an array, ie. i have a for loop spinning out content from my data base and want to be able to to use this function on each paragraph of code individually.Of course i can make the loop increment useing i++ on this links and element ID for example, but i have no clue how to hand this in anyway to the jquery code.
I have a function for totalling decimal values provided in textboxes that form a column on a webpage. This script should total the values in the textboxes, displaying the result in the final 'optotalprogtime' text box formatted as a decimal.
Here is what I've got so far, but I'm getting annoying "object expected" errors on the line where I attempt to format the number (as indicated by the comment below)
//realtime calculation formating as minutes (decimals) function opprogtotalcol() { alert("in opprogtotalcol"); document.getElementById('optotalprogtime').value = 0; for (var rowNumber =1; rowNumber <= 12; rowNumber++){ document.getElementById('optotalprogtime').value = parseFloat(document.getElementById('optotalprogtim e').value) + parseFloat(document.getElementById('opprogmin' + rowNumber ).value); } if(!isNaN(document.getElementById('optotalprogtime ').value)){ //only works for numbers document.getElementById('optotalprogtime').value = formatNumber(document.getElementById('optotalprogt ime').value, 2);//format number here } }
Any insight would be appreciated.
To head off concerns about wrapping code correctly, my code is wrapping pretty bad in this form, but in the acutal page I have long lines that do not wrap.
I have a situation where there is a matrix grid of checkboxes, and individual entire rows or columns must be able to be toggled between checked and unchecked state.
[Code]...
Simple, right? But the columns part, I can't figure out. I put everything in each column in the same class, with the hopes that on click, I'd be able to figure out a way to take the class value of the link - (this).className - and use it to target checkboxes in the same class. But I have no idea how to do this. I haven't been at jquery that long. I'd be incredibly grateful for some help, a starting point, a command that would work....
I have a CF application that accepts two dates. The first date - Out Date - is required. The second date - Return Date - is optional, but if populated, must be equal to or greater than the Out Date. Here's the screen & code:
9974 <script type="text/javascript"> function compareDate() { if(document.editleave.temp_ret_date.value != "01/01/0001")[code]....
Everything works fine....EXCEPT...if the Return Date is invalid, I cannot click on the calendar box to select a date (or open another browser session). Basically, IE is locked up until the user manually types in a valid date.This ain't good.I want to be able to trap the error, just like I have, but I still want the calendar selection box to be usable.Is it possible to "reset" the error condition after the intial warning to only trigger on the onSubmit parameter?
I'm doing this site for my c=school and needs this event calendar. Ive traipsed through this far but stuck with the event showing up. The problem is it will double print the dates that have events. One from the for loop which shows events and other from the normal if function. Following are my files.
I am trying to use the onclose function on phatfusions multibox in order to refresh the parent window when the multibox is closed. The problem I have is that as soon as I load the page it gets stuck in a loop. The code I am using is as follows Code: var box = {}; window.addEvent('domready', function(){ box = new MultiBox('ab', {descClassName: 'multiBoxDesc',onClose:location.reload(true),useOverlay: true}); });
I am really stuck in parsing a JSON string and take it's values. I got the json string as
[Code]....
How to Parse this and take the Results for further processing in javascript.... I am waiting to hear from you Soon..I am using jQuery for the purpose...
I'm having issues with the animate procedure in jQuery. I should start by saying that while I am not new to web developement and scripting, I am fairly new to jQuery so this may be fairly elementry to some of you pros out there.
Basically what I am doing is I have an image map with hot spots, when you mouse over a hot spot, another image (an enlarged version of the hot spot) appears (fading in and growing) and then disappearing on mouse out (fading out and shrinking). My problem is odd because it does not happen every time, but "sometimes" when you mouse over the first animation (grown and fade in) will run then second will run (shrink and fade out) and then repeat until you click outside of the hot spot and the popped-up image. I've noticed the problem mainly occurrs in Firefox (3.5) and rarely or never in IE (8) and Chrome (2).