There are selectbox options for php files. The files are located for inclusion in the same directory category1.php, category2.php, category3.php, category4.php. If these files are moved to a subdirectory for example includes / category1.php, then how can I set the path to the files in the script?
<div class="select"> <form> <select id="projects"> <option value='category1'>Category - 1</option> <option value='category2'>Category - 2</option> <option value='category3'>Category - 3</option> <option value='category4'>Category - 4</option> </select> </form> <script> $('select').on('change', function() { fileGet($(this).val()); }); function fileGet(file) { file = file + ".php"; console.log(file); $.ajax({ url: file, cache: false, success: function(html) { $("#container").html(html); } }); } </script>
file = "includes/" + file + ".php";or sofile = "/includes/" + file + ".php";- Yuri