Jump to content

buckibooster

Members
  • Posts

    27
  • Joined

  • Last visited

Profile Information

  • Gender
    Female

buckibooster's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. I think I'm beginning to understand my problem but still need help in finding a solution.My problem is this. I have a <div> on my main web page ("audioPlayer") with content provided by an AJAX call. The AJAX call occurs as part of a javascript function executed when the web page body is "loaded." My jquery code is contained within a "$(document).ready(function()." This means that my jquery code looks for content that isn't present after loading of the body but only after execution of the AJAX call. As a result, my jquery code is trying to execute within web page elements that are not yet present after loading of the body. I think this means that I need to modify my jquery code so that it executes after the AJAX call has completed. I've attempted this by using the jquery.on() command as follows: $("#audioPlayer").on("ajaxStop", function(){ "my jquery code" }); "audioPlayer" is the <div> I use as a wrapper for my AJAX call contents. It is the only part of this code that is present on the main web page after the body is loaded but before the AJAX call occurs. This should cause my jquery code to execute only after all AJAX calls relating to the "audioPlayer" <div> and its children have finished. Unfortunately, it isn't solving my problem. Can anyone suggest a solution?
  2. In this case, dsonesuk, the first <div> is a first child of <body>. As I said earlier, one of the differences is that the code coming back from the AJAX call is inserted into a <div> that is not needed when the code stands alone in the main web page. If I understand your point, the first <div> in my code is the first child of <body> when it is not loaded though an AJAX call. However, the first <div> in the code returned from the AJAX call is the first child not of the <body> element but of the <div> used as an insertion point, making the the first <div> of the code returned from my AJAX call a second child of the <body> element. If that is all correct, I'm not sufficiently experienced in jquery to understand what you are suggesting as a solution. Do I need to include a jquery.on() command for the insertion <div> at the beginning of my jquery code? If so, what might this command look like? If it helps, the jquery code that is not working with the AJAX call (but does work when the AJAX call is not used) is attached. player.js
  3. Thanks for your post Ingolme but, it really doesn't matter how experienced I am with javascript, when it can't be used to dynamically change the underlying css. As I understand it, only jquery can do that. Also, the javascript functions would also be affected if the AJAX request had not been completed. In any event, the only way that the main page can be loaded is if the AJAX call was completed, as the content comes from that call.
  4. I'm sure that there is probably a simple answer to my question but I haven't been able to find it. I have a php web site that I've built for a local community chorus. Its primary purpose is to provide access to mp3 rehearsal files. For this purpose, I built a html5 audio player that works well in IE11, Firefox, Chrome and Safari. In order to limit access to my sites coding, I'm using an axis call to another php file to gather data from an underlying SQL database to build and insert main page content. In this manner, a ctrl-u of the main page will not show the underlying code. During development, my process has been to first build a part in the main web page until I get it working and then transfer the code to my axis call page. This has worked immensely well until now. The last part of this effort was to build the actual audio player, get it working and transfer it to the axis call page. It worked well when the content was on the main page. However, when I transferred the content to the axis call page, those parts of the player operated by jquery functions stopped working. Parts of the player operated by ordinary javascript functions continue to work just fine. Only those parts operated by jquery functions stopped working. My question is why have the jquery functions stopped working while the javascript functions continue to work just fine? Specifically, the jquery functions that have stopped working dynamically change the underlying cascading style sheets (css) for a number of elements that show loading progress, playing progress and playbackRate. They do this by dynamically adjusting the width of each progress bar based upon the amount loaded, played and the playbackRate. I've looked closely at the results coming back from the axis call and the only differences are: Double quotes have been replaced with single quotes; Single quotes nested inside of double quotes have been replaced with "&quot;" (These nested quotes are not used in the affected elements and the elements they are used in seem to be working just fine.; and The returned insert is nested within a <div> not normally used in the main web page. I should add that I've tested the main page code with this nested <div> and found that the application worked just fine. For some reason, the jquery functions are unable to access and change the underlying css when the elements affected are inserted from an axis call but not when they are directly on the main web page. I'd share some code but there doesn't seem to be any way to do that in this forum.
  5. Thanks Ingolme! That not only solved the problem I was having but another related problem that I didn't even know I had. Thanks again!
  6. Moderator: That part of the code is working and unrelated to the AJAX call problem. I choose to protect that code with the "additional unrelated code that ..." statement at the end of my code snippet.
  7. function getXMLHttp(){ var xmlHttp; try { //Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Your browser does not support AJAX!") return false; } } } return xmlHttp;}function populateEntries(menu, userName, entryRow){ var xmlHttp = getXMLHttp(); xmlHttp.onreadystatechange = function() { if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200) && (xmlHttp.responseText == "")) { window.alert("There are no records to view!"); } else if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200)) { var response = xmlHttp.responseText;// window.alert("PHP Response = '"+response+"'"); } } xmlHttp.open("GET", "getUsers.php", true); xmlHttp.send(null);// ADDITIONAL UNRELATED CODE THAT PARSES THE “RESPONSE,” CREATING A MULTIDIMIENSIONAL ARRAY, WHICH POPULATES A SELECT INPUT FOLLOWS ....} I am using an AJAX call from a javascript to populate a SELECT input. This script is not working as shown in the code excerpt below. However, when I insert an alert of any type at the location shown by the comment, it works as planned. What could be causing this? I've also tried, without success, inserting a delay function after the AJAX call to allow time for the response to be returned (even with the readystate and status tests shown). Any suggestions as to how I can get this to work as desired?
  8. I have a text input tag in html from which I am trying to pass the data input into the tag as it is being typed in (see below). <INPUT TYPE="TEXT" STYLE="width:225px" ID="vData_RptrLName" NAME="vData_RptrLName" onkeyup="showHint(1, this.value)"> As you can see, I've added an onkeyup event within the input tag that calls a javascript function and passes the typed in information as an argument of "this.value." I'm actually trying to create an AXIS call using the letters input into the text field in a hint function similar to that provided in the W3Schools AXIS tutorial. My problem is that whatever I type into the input field is received by the javascript as a value of "1." When I replace "this.value" with specific letters (e.g., "Col"), the javascript works and returns a list of data values beginning with the letter "Col." I can also start the javascript off with a command to get the value of my input field (i.e., document.getElementById("myField").value) and it works as well. Unfortunately, this limits the use of my javascript to only that field. I'm using IE10. Has anyone got any idea why "this.value" isn't working?
  9. Posting a question in a forum is my method of last resort. Before I post, I will pour over reference materials for days trying to find the answer to my question. If I don't have the reference I need, I will go out and find one. Armed with this, I will spend days of trial and error in trying to make my code do just what I want it to. If that doesn't work, I'll go out onto the internet and do some research. This may lead me to a forum question that is similar to mine. On some occasions, these give me an idea that I spend days working with to try to make it fit my needs. Asking a question on a forum is done only after days of wasted research and trial and error has not led to an answer. In other words, I am desperate and need to find an answer. Among the many important things I've learned in my life is 1) if you don't have anything good to say then don't say anything at all and 2) if you're not part of the solution, you're part of the problem. So when I place a question on a forum: If you feel the need to make a joke about part of the question, you're not being part of the solution; If you suggest that another programming language might hold the answer, you're not being helpful; and If you suggest that I post my question somewhere else, you're being a part of the problem. Over the years, I have probably asked a dozen questions on forums. Each time, I was desperately looking for a solution to my problem. What I got in every case was not part of the solution but part of the problem. This is the reason for the attitude. If you can't handle it, move onto another question and let someone who really wants to help and has a solution to my problem answer my question.
  10. I haven't made many posts on these forums but the only answers I ever get are either snide remarks on my question or suggestions that I post elsewhere. Does anyone ever offer any real help? Bob
  11. L8V2L: Maybe I should post it to the Excel forum instead. Oh wait, there isn't any Excel forum. If you have no answer that will help, you can just move on and not reply. Bob
  12. I've created a php file that gathers data from my SQL tables and creates a multi-sheet Excel workbook file in XML. I started this process by creating the file as I wanted it to appear using MS Excel 2010 and saved it as a XML file. I then wrote my PHP code to dynamically create the MS Excel XML file. In internet Explorer 11, when this is done, the file opens as a MS Excel file. My problem is that it doesn't work in Firefox (Version 31.0). In Firefox, it prints out on the screen as an unformatted XML file with the following message above the screen - "This XML file does not appear to have any style information associated with it. The document tree is shown below." I think the problem is in my header. This is the way the opening of my PHP file appears now: <?phpheader("Content-type: text/xml");echo "<?xml version="1.0" encoding="UTF-8"?><?mso-application progid="Excel.Sheet"?>";?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"><-- More code follows --> Any help you can offer will be welcome!
×
×
  • Create New...