javascript - Getting the host URL + the destination URL when -


i using ajax post call data file located on other server, getting host url + destination url url ajax url!

  • my host url: 192.168.1.2
  • my destination url: 192.168.1.7/var/www/html/pfe/ajax.php

how destination url only?

var url = "192.168.1.7/var/www/html/pfe/ajax.php";     $("#c1.on").click(function () { $.ajax({         url: url,         type: 'post',         data: { on : true, pin : 16 },         success: function(data){             $("#c1.on").addclass("hide");             $("#c1.off").removeclass("hide");         }     }); }); 

the url get: 192.168.1.2/192.168.1.7/var/www/html/pfe/ajax.php

the url syntax incorrect. if url doesn't have // in it, it's treated filename on same server current page. should be:

var url = "//192.168.1.7/var/www/html/pfe/ajax.php";     

the // indicates next component name or address of server.

not still may not work because of restriction against cross-domain ajax.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -