pass filename as variable to jQuery script

235
June 27, 2017, at 02:27 AM

I want to pass a filename to a jQuery script. The complete path is set as a variable in a php file called $filerurl. jQuery should open the file, using the path and filename in that variable, but it is not working at all. Is there something wrong with using url: "", or is the variable not being passed to the script for some reason?

If I hardcode the filename into the jQuery script it works.

jQuery(document).ready(function() {
 "use strict";
 jQuery.ajax({
    type: "GET",
    url: "<?php echo $fileurl?>",
    dataType: "text",
    success: function(data) {processData(data);}
  });
});

Thanks!

READ ALSO
How to login in php to a password protected folder? [on hold]

How to login in php to a password protected folder? [on hold]

I have a php file, what contains database passwordsIn cpanel, I protected them with a password, but how I can login to it in php? Because it is not letting me to include the file

191
POST data from php to my SWIFT 3

POST data from php to my SWIFT 3

Hey Hello I have a problem with my code I have this problem for 3 days, I cannot solve it by myself

153
Add Carriage Returns Between Two HTML Tables

Add Carriage Returns Between Two HTML Tables

I have the following syntax which generates and creates two tables for meThe issue that I have is that the top table is directly on top of the bottom table

257
extract specific URLs from text

extract specific URLs from text

I want to extract URLs from this text:

169