Jump to content

buckibooster

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by buckibooster

  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!
  13. I'm trying to validate a form at submittal. The code for my web page is written in php (i.e. server-side). The php file consists of a body file (i.e., body.php) included in a header file (i.e. tool.php). The included body file contains the html code for the body with form. The following php code is inserted at the top of the body file (i.e., before the html <body> and <form> fields: <?php //Check the validity of the data entered $activity01 = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $activity01 = $_REQUEST[activity01]; include($_SERVER['DOCUMENT_ROOT'].'included_filesincPHP1.inc'); $cxn=mysqli_connect($host,$user,$password,$database) or die ("Couldn't connect to the server."); $result = mysqli_query($cxn, "SELECT counter, Activity_Task FROM jsaheader WHERE Activity_Task = '$activity01'"); $counter = mysqli_num_rows($result); $row = mysqli_fetch_assoc($result); if ($counter == 0) { mysqli_close($cxn); } else { mysqli_close($cxn);?> <SCRIPT type="text/javascript"> window.alert("The 'Activity / Task' that you have selected is not unique. There is already another JSA with the name '<? echo $activity01 ?>.' As each 'Activity / Task' must be unique, you will now be returned to the previous page so that you can select a unique 'Activity / Task.'");</SCRIPT> <? } } ?> The problem input field is a text field located within the included body file. The input field content looks like this: <INPUT type='text' size=75 id='activity01' name='activity01' value='<? echo $activity01;?>'> When the form is submitted, the php code shown above queries a SQL database to verify that the activity is unique. I've verified that this is actually working. If it is not unique, the user is informed of this through a popup alert and returned to the form. They actually never leave the form. Because of the code within the value attribute, the previously entered activity is supposed to be shown in the input field as it was originally entered. It doesn't but when I look at the source code it shows up there as "value='Test JSA 1'." Got any ideas why that is? The only thing I can think of is that this is happening because the form (and body) is contained within a php file included in the header file. Any help you can give will be very much appreciated.
  14. I'm in the final stretch of this project. It 1) takes data from a server-side SQL database using php; 2) generates and saves a xml file to the server; and 3) uses a xsl transform and word template document along with the previously generated xml file to generate a word 2010 document which is pushed out to the client. I've been able to get the word document working just fine for all of the text fields but am having trouble with the checkbox. I want to be able to check or leave un-checked a checkbox in the word template document based upon a value in the xml file. The relevant xslt code section is: <w:checkBox><w:sizeAuto/><w:default w:val="0"/></w:checkBox> If I could change the default "val" from "0" to "1" based upon the content of the xml file, that would make the change I'm looking for. I've already written code to create a "0" or "1" in the relevant location on my xml file. All I need to know is how to change the xsl transform code based upon a "0" or "1" value in the xml file. Any suggestions would be welcomed.
  15. Cryptic and of little help. Thanks for the effort.
  16. Thanks ADHD but the file is being generated on the server side using php. The form on my site submits to a server side database using a php file. This php file uses the submitted data to create a xml file on the server file by editing the code from my xml Word file. This dynamically created xml file is then displayed through the php file. Unfortunately, the xml file displays as code and not the word document it is generated from.
  17. Let me preface this thread by saying I know very little about xml but a good deal about php. My overall goal is to take data entered by my users to create a word report which is sent back to them through their browser. Up to this point, I have: created a report document in MS Word (2010); saved it as an xml file; opened the xml file using notepad to view the underlying xml code; figured out how to edit the code the way I want to using php; copied the original xml code into a php file with additional php code to modify the file; and tried to publish the edited xml file from within my php file to my web browser (IE 10). My problem is that my browser displays the file code correctly within the browser instead of the word document as it should appear after editing. How do I get the code to publish in my browser as a word document? Thanks in advance for your timely assistance.
  18. I have an application that needs about a dozen separate unrelated and independent javascript functions to run as designed. At present, they are all in a single header (about 17,700 lines of code). All of them, except one, have less than 100 lines of code. The one exception has over 16,000 lines of code. Is there any limit to the number of javascript functions that can appear in a header? Is there a limit to the function size? Do they have to be placed in any specific order? If yes, I'm assuming that I will have to carve them out into separate included js files. If this is the case, the number and order of separate included js files will depend on the answer to these questions.
  19. Thank you Ingolme! I believe that your solution will work for me.
  20. Why is it that when I call a php page and pass a number of variables to it, one of which contains the "#," that it truncates the string and does not pass any of the variables that follow? For example: http://www.anysite.com/run.php?age='7'&Processed='No'&Description='20140323 Test Proposal #2'&Division='CC57' This call transmits everything until it gets to the "#" sign and stops. The string of passed variables always stops at the "#" character and does not include it. When I remove the "#" character from the passed string, however, everything works just fine. Are there any other characters that must be avoided?
×
×
  • Create New...