Jump to content

ajax with subfolders path faild


linuxfreakphp

Recommended Posts

i have a problem with the path. i even tried put  the js and the php in the folder,but the js don't find the php.

 

the js is working but it is isn't find the php page and i don't know why.

i check with

<?php
echo '<script language="JavaScript">alert("1");</script>';
?> 

with the address in the browser: 'http://127.0.0.1/folder/private/php/index.php' and the php page is fine.

 

127.0.0.1

               folder

                        index.html - html file

                        private - folder

                                  php

                                        index.php - ajax js file

                                  js

                                        index.js - ajax js file

the path  i have gave to the js file:

'./../php/index.php' (work in other models of ajax i have)

'http://127.0.0.1/folder/private/php/index.php' is working fine if i'm insert it to the browser.

 

i even tried when i put the files (js and php) in the same folder as html, but it is n't working in this model.

127.0.0.1

               folder

                        index.html - html file

                        index.php - ajax js file

                        index.js - ajax js file

the path  i have gave to the js file:

'index.php'

 

what is the problem?

Link to comment
https://forums.phpfreaks.com/topic/284766-ajax-with-subfolders-path-faild/
Share on other sites

Give it the full absolute path, not a relative path.

hey, i found what was my problem in this model.

the path i gave was from the javascript to the php, but the reference to the php need be to the html file and not to the js file.

once i set the path in the external js file so the path will be from the html to the php and not the js file the problem solve.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.