I am trying to use the jquery ajax $ .get (...) function to send a request to my server and return some data to it. I am using the following code:
$.get("php/getRocks.php", { name: "John", time: "2pm" }, function(data){ alert("Data Loaded: " + data); });
Instead of returning the data, it simply returns the entire php file as a string. Am I doing something wrong? Thanks for the help.
Well, it looks like I solved the problem, sort of. Apparently, if I access the local site, php does not work, but if I use the domain name, it does it. Does anyone know why? Or better yet, a way to fix it?
Thank you all for your help!
PHP ? . - .php , PHP- .
:
, , , , . -, , php , , . - , ? , ?!
, , , , . -, , php , , . - , ? , ?
!
( ) PHP , . , . , Uniform Server, .
( MAMP mac), , .
, , - / . url getRocks.php( script ), ( ), php/getRocks.php, ( php- ).
, MAMP - ? , , , .
. , php
linux/apache2 php 5 / apache php dso :
LoadModule php5_module modules/libphp5.so
, jQuery, / -:
apache, , conf:
AddType application/x-httpd-php .php
More details about php and apache if you use php anad apache on linux / nix, for example: http://dan.drydog.com/apache2php.html
Source: https://habr.com/ru/post/1714692/More articles:Disinfect all user input in PostgreSQL with PHP - phpHas anyone tried to install ruby & rubygems from a source on ubuntu (preferably unbuntu 9)? - linuxHow to expand numpy inf objects? - pythonTo create a question for a given user in PostgreSQL using PHP - phpКак вставлять видео в HTML-страницу - htmlReading and writing to the registry using VB.NET - vb.netExcel 2007 VBA - Runtime Error 1004 - excel-vbaGridview теряет ItemTemplate после удаления столбцов - asp.netDjango admin file upload does not work, how can I debug this? - djangojQuery UI - Default behavior of multiple elements (ctrl + click) for "selectable"? - jqueryAll Articles