Referencing a file in view.php

noscrodamus wrote on Wednesday, May 04, 2016:

  $(".export").click(function() {

        $.ajax({
  url: '../../tempformdat/test.php',
  success: function(response) {
    alert(response);
  }

little snippet i wrote in view.php for one of my forms.
Url portion only seems to work when i prefix it with the …/…/
doesnt work when i just use the file name or put test.php file one level up and use …/test.php
why is this?

mdsupport wrote on Wednesday, May 04, 2016:

Forms get invoked by frame source so it may be using that processes’s directory. In any case, you can use alert process.cwd() to debug. As a general rule though, you are always better off using php to place one of the globals so your effective url will be completely specified.

noscrodamus wrote on Thursday, May 05, 2016:

awesome, thanks. ill try out process.cwd!