Jump to content

Search the Community

Showing results for tags 'ajax'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. I'm attempting to pass a text string from a javascript process to a php process, using XMLHttprequest, and am getting an 'undefined array key' error. The php process should save the string to a file. It appears to pass the string to the php code okay as it returns the message 'File saved', but it also gives the error message 'undefined array key' on 'data' on line 2 of the php code. I appears to be saving a blank string to the text file as it overwrites any previous saved text in the file. So it looks like no data is being passed to the php codebut it is still try to save it. I'm no sure whether the problem is on the javascript side or the php side. The attached files are test code which reproduces the error. Clicking on the button in 'TestProgram.php will attempt to pass the test string to 'saveGame.php which should save the text string to 'test26.txt :- Any help would be much appreciated. TestProgram.php saveGame.php test26.txt
  2. BACKGROUND: I have a javascript document that is dynamically loaded when a certain condition is met. In this document there are two functions: the first function is called submitForm(), and the second is called resetForm(). Each of these functions is triggered separately by a different button on the same HTML webpage. Both functions rely on the same PHP class, but each relies on data created by a different instance containing different data. The first instance is created at run time and is ultimately read into the submitForm() function. The second instance is created at the visitor's discretion via an AJAX call that is made when the resetForm() function is triggered. The success function of the AJAX call made by the resetForm() function generates a value needed by the submitForm() function when it is run for a second time after the resetForm() function has already been called once. QUESTION: How do I get the resetForm() function to return a value generated by its AJAX call's success function in a manner that it can be used by the submitForm() function? Sorry, no code, as the whole process is even a little more complicated than what has just been explained.. Please advise. Roddy
  3. Crann

    AJAX write

    I am tying to make a file that will write to another file.
  4. Attention: W3schools Javascript forum members: Earlier this morning I coded a simple AJAX script to post a line of text and a button to a web page and then, upon clicking the button, to print the text ( in the "ajax_1.txt" file ) to the web page. The AJAX script is as follows: <!DOCTYPE html> <html> <body> <div id="demo"> <h1>Let AJAX print this text</h1> <button type="button" onclick="loadDoc()">Print Content</button> </div> <script> function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("demo").innerHTML = this.responseText; } }; xhttp.open("GET", "ajax_1.txt", true); xhttp.send(); } </script> </body> </html> The file "ajax_1.txt" is as follows: Name = Russell E. Willis. Birth Date = 12/21/1966. Age = 52. The line of text and the "Print Content" button appear in the web browser ( as indicated in the "<div-</div>" portion of the script file above ( but I was unable to insert the screen capture file of the output into this posting due to space limitations )). Why is the text file not appearing in my web browser when I click on the "Print Content" button? What am I doing wrong? NOTE: The script file above is just a minor variation of an example provided on your web page. Thank you ( see Colossians 3:15, for example ) for your help. Keep in touch.🙂 Sincerely in Christ, Russell E. Willis P.S. - Please read Proverbs 23:23.
  5. Hello potential helpers, im currently having issues with firing an ajax request inside of another ajax request. Heres my code: Im not getting "alert(content)" Condition if(shop[1] == "gserver") and if(name.includes(shopname) == true) are definetly true. The function is correctly called as well. No Im not using jquery for reasons. Anyone has an idea why the 2nd requests isnt fired? Is it not waiting for the first one to finish? function initiate_shop_game(shopname) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if(this.readyState == 4 && this.status == 200) { var obj = this.responseText; var array = eval("[" + obj + "]"); var r = 1; for(var i = 0; i < array.length; i++) { for(var x = 0; x < array[i].length; x++) { var shop = array[i][x] + ''; shop = shop.split(","); if(shop[1] == "gserver") { var name = shop[2]; var imgname = shop[7] var shopvalues = shop[3].split("{%TEND%}"); var minslots = parseInt(shopvalues[1]); var maxslots = parseInt(shopvalues[2]); var minram= parseInt(shopvalues[3]); var maxram = parseInt(shopvalues[4]); var pricea = (parseFloat(shop[5]) / 30); var priceb = (parseFloat(shop[6] / 30)); var content = [name,imgname,minslots,maxslots,minram,maxram,pricea,priceb]; if(name.includes(shopname) == true) { var div = document.createElement('div'); div.id = name; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { alert(content); }; xmlhttp.open('POST',"/template_shop.php", true); xmlhttp.send(); } } } } } } }; xmlhttp.open('POST',"/get_shop_data.php", true); xmlhttp.send(); }
  6. Hi Am trying to submit the data to server, nothing is received on server. I mean "dismissed students" and "failed students " am filling and sending but not receiving on server side. How to get the data on server side. <div id="Examination" class="tabcontent"> <html> <body> <p id="exam"></p> dismissed students: <input type="text" name="index1" size="10"> <br><br> failed students: <input type="text" name="index2" size="10"> <button type="button" onclick="entry()">submit</button> <script> function entry() { var formData = new FormData(); var valid = new XMLHttpRequest(); valid.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("exam").innerHTML = this.responseText; } }; valid.open("POST", "exam.txt", true); xhttp.send(formData); } </script> I just added "formData" and i get just some junk characters not original data.How to fill the data in "formData" How to get the data, anything else is required to make it work. Thanks Avinash
  7. GENERAL QUESTION: Can variables created outside of a function be used within a function without having to read them first as arguments of the function? If so, can a function created within a function use a variable created outside of both functions? CODE var dataString = 'search_input=' + search_letter_input; $.ajax({ type: "POST", url: './...', data: dataString, dataType: 'JSON', statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(jsonData) {...} }); SPECIFIC QUESTION: I would like to use the value of the variable search_letter_input in the success function of the $.ajax( ) method. Is this possible? Roddy
  8. BACKGROUND: I have now tried a number of ways to make two cURL calls within the same Javascript (jQuery) routine. For each new way, I have discovered what I believe to be a reasonable explanation for my failure. For my most recent attempt, however, a good explanation is not forthcoming. To be sure, single AJAX calls with a single cURL call for each yield the desired results. Simply I cannot seem to combine these results simultaneously on the same page. The scenario given below, for example, returns the desired outcome for the second cURL call, but not the first. JAVASCRIPT: $.ajax({ url: '.../VisitsSummary.php', method: 'GET', data: {methodName : '_get', methodName : '_getSumVisitsLengthPretty'}, dataType: 'JSON', statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(visitsSummary_data) { console.log(visitsSummary_data); var tv = visitsSummary_data.nb_visits; var uv = visitsSummary_data.nb_uniq_visitors; var visits_per_unique_visitor = Math.round(tv/uv * 10)/10; $('#so_total_visits').html(visitsSummary_data.nb_visits); $('#so_unique_visitors').html(visitsSummary_data.nb_uniq_visitors); $('#visits_per_visitor').html(visits_per_unique_visitor); $('#so_average_time_spent').html(visitsSummary_data.avg_time_on_site); } }); PHP: if (isset($_GET['methodName'])) { $method_name = $_GET['methodName']; if ($_GET['methodName'] == '_get') { $url = 'https://.../index.php?module=API&action=index&method=VisitsSummary.get&idSite=1&period=year&date=today&format=json&token_auth=&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); if(curl_errno($curl_request)) { echo 'Curl error: ' . curl_error($curl_request); } curl_close($curl_request); } if ($_GET['methodName'] == '_getSumVisitsLengthPretty') { $url = 'https://.../index.php?module=API&action=index&method=VisitsSummary.getSumVisitsLengthPretty&idSite=1&period=year&date=today&format=json&token_auth=&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); if(curl_errno($curl_request)) { echo 'Curl error: ' . curl_error($curl_request); } curl_close($curl_request); } } QUESTION: Can you find anything wrong with the above strategy? If so, what would you recommend to replace it? Roddy
  9. BACKGROUND: I have a plain text file with an .html extension. In the file is a <p> element into which I would like to enter the current date. The file is called from its hostpage via a jQuery $.get() statement that is followed with an AJAX call to a PHP processing file that returns JSON that can be processed in the AJAX success function as an object. QUESTION: If I place the PHP necessary to create the date in the text file with the .html extension, will it appear in the hostpage when called by the $.get() method? NOTE: My server is programmed to accept PHP in files with a .html extension. Mind you, the text file has neither <head>, nor <body> element, let alone a <DOC> header. Roddy If I enter the data with PHP before the AJAX
  10. How i make a Real time comment-replay script system in a website ?
  11. GREETING: One more quick question before the weekend begins. BACKGROUND: Until now, it has been easy to see the results of AJAX calls in the files that produce them. Until now, cURL was never an explicit part of my web-application. I am now making a dual call, however, and am unable to see the final result. The first call stipulates no method as nothing is sent. The second call is based on the result of the first call and uses the POST method to make the request. Although I can see the contents of the first request, I cannot see the contents of the second. Both files use identical cURL routines and both perform exactly as expected, as AJAX returns everything that is requested. Only the query statements of the URL are different. Even the specified AJAX dataType is the same for both calls -- namely, JSON. Please find below the code that produces the output that I wish to see, but cannot. The PHP for the 2ND AJAX CALL ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log'); ini_set('html_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); if (!empty($_POST['ip_addr'])) { $ip_addr = filter_var($_POST['ip_addr'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); $url = 'https://.../matomo/index.php?module=API&action=index&visitIp=' . $ip_addr . '&idSite=1&period=week&date=today&method=Live.getVisitorProfile&format=json&expanded=0&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); curl_close($curl_request); } QUESTION; What must I do to make the output of the cURL call visible in the file that produces it without disrupting the AJAX call that retrieves the output that I cannot see. Or, am I missing the whole point of cURL and the data is tranferred directly to the AJAX? But, why would I be able to see it in the first request, but not the second. Roddy
  12. BACKGROUND: A visitor arrives on a website. While still on the site he triggers an AJAX call that fills a <div> element with new HTML. Once the page is filled another AJAX call is made that seeks to read the following value as encoded JSON: $_SERVER['REMOTE_REFERER']. Instead I receive a 500 internal server error. The AJAX (function() { $("#main").html(''); $("<link/>", { rel: "stylesheet", type: "text/css", href: "./_utilities/css/yourprofile_filler.css" }).appendTo("head"); $.get('./yourprofile_filler.html', function(data) { $('#main').html(data); }).done(function(){ $.ajax({ url: './_utilities/php/visitor_ip.php', dataType: 'JSON', statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(visitor_ip) { console.log(visitor_ip); } }); }); })(); The PHP <?php $referral_addr = $_SERVER['REMOTE_REFERER']; echo json_encode($referral_addr); ?> ERROR MESSAGE jquery.min.js:5 GET https://www.grammarcaptive.com/_utilities/php/visitor_ip.php 500 (Internal Server Error)send Is the $_SERVER variable not available in the moment of the AJAX? How do I otherwise make it available? Roddy
  13. BACKGROUND: I am querying a MySQL database with a Matomo GUI. The API is called imageGraph. The call to the API works, as I have produced the desired image by assigning the URL as the value of an href attribute of an HTML <a> element. When using this link to display the image the image appears on a new page with its own header. This is not the effect that I desire. My goal is to display the image within a <div> tag on a webpage. The code that is suppose to achieve this latter effect is provided below. The URL that fetches the data from the API is identical for both the link and the PHP processing page for the AJAX call provided below. The PHP (./practice.php) $url ='https://.../matomo/index.php ?module=API &method=ImageGraph.get &idSite=1 &apiModule=Referrers &apiAction=getReferrerType &token_auth= ... &period=day &date=2018-04-10,2018-05-09'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_exec($curl_request); curl_close($curl_request); The HTML <div id='referral_types'> <img src='' alt='Line Chart of Referral Types' /> </div> The Javascript $(document).ready(function() { $.ajax({ method: 'GET', url: "./practice.php", cache: false, contentType: 'image/png', success: function(response) { console.log(response); var graphic_src = response; $('#referral_types').find('img').attr('src', graphic_src); } }); }); EXPERIMENTATION: The console indicates that practice.php has been read, as it is filled with the kind of character nonsense typical of an image file. As the API permits an optional &format parameter I experimented with several including the following: AJAX PHP dataType JSON, &format=json dataType XML &format=xml (omit) &format=original The result was invariably the same. The ALT message with no image. Please advise. Roddy
  14. i was trying to use a ajax returned value out of the ajax function but it didn't work. can anyone please guide me. here is the code i tried. var lat, lng; $.ajax({ url: url, dataType: "json", method: "get", success: function(res) { var lat = res[imei].lat; var lng = res[imei].lng; } }); $("#lng").text(lng); $("#lat").text(lat); thanks in advance.
  15. hello all, i am trying to run an ajax request inside a for loop. and when the response is true, i want to run another ajax only once. but the second ajax also runs multiple times. here is the code i tried .... var i; for (i=0; i< feeid.length; i++) { $.ajax({ url: "submitnewjournal.php", method: "POST", data: { m: m, fullvn: fullvn, vn: vn, }, }) .done (function(result) { var success = $(result).filter("#success").text(); $("#msg").text($(result).filter("#msg").text()); if (success == "NO") { $('#pwait').hide('clip', "fast"); $("#msg").css("color", "red").show("bounce", 100); $('#feelist, #studentlist').show('fade', 250); } else { $("#msg").css("color", "green").show("bounce", 100); $("#fullvn").text($(result).filter("#newfullvn").text()); $("#prefix").text($(result).filter("#newprefix").text()); $("#vn").text($(result).filter("#newvn").text()); /***********************************************************************************************/ /************************* this is the part i want to run onle one time*************************/ /***********************************************************************************************/ if (sendnotice == "Y") { $("#msg").text("Invoice saved successfully. Now sending notification!"); var target = "< PARENTS >"; var receipients = "INVOICE"; var clas = $('#clas :selected').val(); var sec = $('#sec').val(); $.ajax({ url: "noticeprocess.php", method: "POST", data: { target: target, targetid: target, receipient: receipients, token : receipients } }) .done(function(result) { $("#msg").hide("fade", 100).empty().text($(result).filter("#msg").text()); var success = $(result).filter("#success").text(); if (success == "YES") { $("#msg").css("color", "green").show("bounce", 100); $("#pwait").hide("clip", "fast"); // $('#mainarea').load('mnthsalary.php'); } else if (success == "NO") { $("#msg").css("color", "red").show("bounce", 100); } }) .fail(function(e) { $("#msg").hide("fade", 100).empty().text("Connection Error!").css("color", "red").show("bounce", 100); }) window.open("print.php?m=newmnthinvoice&invno=" + fullvn, "_new"); /*********************************************************/ } else { $("#msg").text("Invoice saved successfully."); $('#pwait').hide('clip', "fast"); } } }) .fail(function() { $('#pwait').hide('clip', "fast"); $('#msg').text('Connection problem!').css('color', 'red'); $('#feelist, #studentlist').show('fade', 250); }) } please guide me how can i achieve this. thank u in advance....
  16. I've built a static site with over 40,000 pages using Jekyll. I am trying to implement a live search into it without a database. I tried the w3schools live search example with a xml file I created from my site. It is very slow. Does anyone know of a faster way to parse xml files or am I wasting time. I enabled gzip compression on the entire site also, What would be the fastest way to search a lot of records and return a result? Thanks in advance.
  17. BACKGROUND: My objective is to replace the content of an existent <div> element with new content that depends on newly loaded javascript, css, and a JSON object retrieved from a PHP processing file by an AJAX call. To this end I have written the following brief piece of code. To be clear the script contained in wordcount.js depends on the value of wordmax. Further this same script is triggered when text is entered into a <textarea> form control found in newsletter.html. Please review the code and answer the questions that follow. .click(function() { $('#main').html(''); ajax_obj = $.ajax({ url: 'newsletter_filler.php', data: {name : 'personal, length : 200}, dataType: JSON, statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(jsonData) { $.getScript('wordcount.js', function(data) { var wordmax = jsonData; }); $.get('newsletter.css', function(data) { $('head style').append(data); } $.get('newsletter.html', function(data) { $('#main').html(data); } } }); } QUESTION ONE: Under the assumption that all of the code in the called files has been properly written and that the content of the .css and .html files is properly placed will the script contained in wordcount.js execute properly when triggered by the content of newsletter.html? QUESTION TWO: Will the content of the files newsletter.css and newsletter.html find their proper place and function as one might expect from such code, if it had been placed in the main document in the elements indicated by jQuery selector at the outset? Roddy
  18. BACKGROUND: I have learned to keep a log that increases incrementally with the generation of each new newsletter and podcast. 1) Read the Current Log Value $file = './episode_index.txt'; if (file_exists($file)) { $json_str = file_get_contents($file); $episode_no = json_decode($json_str, true); $number = $episode_no['episode_no']; $new_episode = $number + 1; } else { echo 'The desired file either does not exist, or does not exist in the indicated location.'; } 2) Take Some Action and Update the Log Value Incrementally if (!is_blank($_POST['letter_no'])) { $episode_no['episode_no'] = $number + 1; $json_str = json_encode($episode_no); file_put_contents($file, $json_str); } in effect, I perform a simple file_get_contents and file_put_contents on a single document whose only value is that of a single JSON object whose value increases incrementally with the creation of each new newsletter. In order to keep track of my podcasts I need something vastly more complex, for not only must I be able to automatically generate a new counter with each new podcast that I generate, but each counter thus created must keep track of each and every hit of any and all podcasts by each and every known and anonymous podcast user. Further, once this data is recorded it must be easily accessible for the purpose of analysis. In effect, I am loathe to generate a separate document for each new podcast. Although a workable tool for each individual podcast, i cannot imagine it as a very effective way to manage data for all of my podcasts in aggregate or any desired subset thereof. Perhaps I could create a single MySQL table with a set number of fields for all podcasts. Then, 1) With each new podcast insert a new row of data, and 2) with each new user hit of a particular podcast update the field values for the affected row. Might I receive some input in these regards? Roddy
  19. BACKGROUND: I have created a PHP routine that gathers data from a MySQL database. The data that it gathers depends on the value of an HTTP request that uses the $_GET superglobal as its transfer mechanism. The routine further organizes the retrieved information into a nested array such that each element of the array corresponds to a different table row, and each element of each nested array corresponds to a subset of the table fields. Once the nested array has been completed the json_encode() function converts the array into a JSON string and readies it for transport. The PHP <?php if(isset($_GET['podType']) { define('_HOST_NAME','...'); define('_DATABASE_NAME','...'); define('_DATABASE_USER_NAME','...'); define('_DATABASE_PASSWORD','...'); $mysqli_obj = new MySQLi(_HOST_NAME,_DATABASE_USER_NAME,_DATABASE_PASSWORD,_DATABASE_NAME); if($mysqli_obj->connect_errno) { die("ERROR : -> ".$mysqli_obj->connect_error); } $tbl_name = 'rss2_podcast_item'; $podcast_items = []; $result_obj = $mysqli_obj->query("SELECT * FROM " . $tbl_name); while($row = $result_obj->fetch_assoc()) { foreach($row as $key => $value) { $item_arr[$key] = $value; } $items[] = $item_arr; } //Creates a nested array whose subarrays consist of the four indicated elements. foreach ($items as $sub_arr => $element) { $podcast_item[] = $element['podcast_no_item']; $podcast_item[] = $element['item_title']; $podcast_item[] = $element['item_description']; $podcast_item[] = $element['item_pubdate']; $podcast_items[] = $podcast_item; $podcast_item = []; } echo json_encode($podcast_items, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK); } ?> The Javascript <script> $(document).ready(function() { $('li.podDex').each(function(){ var podType = $(this).attr('id'); //Causes the weight of the font to change when the mouse passes over the text. $('#'+podType).mouseover(function() { $(this).css({"cursor": "pointer", "font-weight":"800"}); }) .mouseout(function() { $(this).css("font-weight", "normal"); }); //Causes the weight of the font to change, displays the hidden text to appear in the #main <div> element, and brings about a change in color. $('#'+podType).mouseover(function() { $(this).css({"cursor": "pointer", "font-weight":"800"}); }) .click(function() { $.getJSON({ url: "../exp1/ajax_data.php", data: podType, success: function(json_data){ var data_array = $.parseJSON(json_data); alert(data_array[0]['podcast_no_item']); } }); }) .mouseup(function() { $(this).css({"color": "#fadb9d","font-weight": "normal"}); $('body, html').animate({scrollTop: $('#main').offset().top},800); }); }); }); </script> The HTML <ul> <li id='linear' class='podDex'>Linear Analysis</li> <li id='clausal' class='podDex'>Clausal Analysis</li> <li id='inversion' class='podDex'>Socratic Inversion</li> <li id='chronology' class='podDex'>Chronology</li> </ul> The Console Error Message is You are welcome to try it yourself. Please go to Grammar Captive and click on any of the four designated <li> elements. QUESTION: What might be causing the $.getJSON() call to fail? NOTE: A similar, but not identical, result occurs on my local test server.
  20. Hi all, I'm just starting to get into website design, tho' I've been a programmer for many years. I've got a site going pretty well, but I really want to update the information on the site every day using tables. I am studying the AJAX/XML method and I think I must be missing something. After using the 'display CD collection' as a model, I couldn't get it to work. So then I tried copying & pasting the actual files from the example ( they list the xml file for your reference ) into a folder and Opened it with a google browser. I can get the button that says 'create my CD collection', but nothing happens when I click it. What am I missing; is there another article that might explain this in more detail and say exactly what's going on? Thanks
  21. RECENT DISCOVERY: I recently discovered a handy PHP function called show_source( ) and would now like to apply it in a particular sort of way. GOAL: I would like to open a new tab in my current window that shows the source code of a page that I have opened in the window. DILEMMA: Since PHP operates before a page is opened I am a lot confused about how to make this happen. This is what I have accomplished so far. $( document ).ready(function() { console.log( "ready!" ); $('.show_src a').on('click', function(event) { event.preventDefault(); var address = $(this).attr('href'); window.open(address); ... }); }); <li class='show_src'>The <a href='./composer/php_rss_generator/RSSGenerator/ItemInterface.php' title='' target='_blank'>Interface</a></li> <li class='show_src'>The <a href='./composer/php_rss_generator/RSSGenerator/Item.php' title='' target='_blank'>Class</a></li> I have tried a variety of ways to replace the three dots above including .ajax( ) and window.write( ) but nothing seems to work. Any ideas? Roddy
  22. Hi... I am inside Ajax success function... here is my code... I have accessed the client server url successfully, but also I have to execuet the query that i have to get the result inside the Ajax function to post in my jsp page..... can someone please assist on how we can acheive this? function Call() { var query='select * from employees'; var querystring = "joinType=3&userLocale=English&query="+query&maxrow="2; $.ajax({ url:'https://testurl', type:'POST', success: function(data, url, jqhxr) { $('#div').html(this.url); console.log('Am here nowww',this.url); } }); };
  23. I have a coded servlet already in HTTP url. I want to access and display the data from (http url) servlet to my new JSP within <div> here is the more details :https://gist.github.com/theakathir/f6fb390d35b451a57958aa0d3cf05330 about the servlet content. I am very new Ajax,. All i want to do in, In my new jsp page i will have a button to click which will access the data from the http url (servlet) using Ajax. Can someone direct me with some reference to start with.. It would be helpful Thanks.
  24. First off, thanks for letting me into the forums. Excuse a newbie but I have a question about fetching data from a database with PHP and AJAX. Let's say I wanted to fetch data from the database like in this example from W3Schools, but I had modified the dropdown to for example fetch all entries with last name Griffin, Swanson or Quagmire. I made the q variable take a string instead of an integer. $q = strval($_GET['q']); Now I want to expand the SQL query to also take another condition. "SELECT * FROM user WHERE LastName = '".$q."' AND Hometown = '".$q2."'"; I understand how to build the query and that I need to declare another variable (q2), but how do I modify the AJAX request? xmlhttp.open("GET","getuser.php?q="+str,true); Also, would I need to have a submit button now that there are two conditions? Thanks!
  25. I'm looking for a way to display the contents of an XML file on a web page with AJAX. I rely on the w3schools "simple CD catalog application", which shows a part of the XML (author and title) and, when you click on a title, displays the details of the CD. I need, however, to be able to add sorting and filtering when displaying artist and title - it could, for instance, be sorting the titles alphabetically or apply a filter based on the year of release. XSLT doesn't seem to work with AJAX so I hope JavaScript could be the answer: Is it possible to add such functions to the application example using JavaScript - and how could it be done? I'd really be glad if someone could help.
×
×
  • Create New...