I am trying to create a messaging system for my website, but I cannot start my ajax. Therefore, I am making a simpler version of the interaction between files.
Here is my file and test.php and load.php are in the root folder (public_html).
I have ajax function in test.php. load.php just echoes wow.
$("#test").click(function(){ alert("Clicked."); $.ajax({ url:"/load.php", type:"POST", beforeSend: function(){ alert("testing"); }, success:function(result){ $("#result").html(result); alert(" sss "+result); } }).error(function(){alert("wrong");}); });
Now it works great.
........... how to set the relative path ...
Here is a more complex design
3 files, all in a different folder:
- messages.php (as root)
- control.php (root / panels)
- the panel will be included in messages.php
- load.php (root / functions)
- control.php will use ajax to call and then display the result in control.php
so when the user loads in messages.php, he will load control.php and then run ajax call control.php.
I am so confused about how to configure these paths for ajax
(including control.php in .php posts works fine)
thanks
source share