jquery - AJAX call not working to PHP -
this making no sense @ all.
i've tried work code on web platform , computer.
here checklist.
1) port 3306 open mysql.
2) code minimized shown below.
3) used online php code tester see if there errors.
4) used document.ready , called method ajax call.
5) used alert test if html contained errors.
6) checked file permissions
7) mysqli
here code:
php
<?php include 'pass.php'; //ini_set('max_execution_time', 4000); ini_set('memory_limit', '16m'); try { $con = mysqli_connect($host, $username, $password, $db_name, $port); if (mysqli_connect_error()) { echo 'could not connect database'; } echo 'hello'; } catch (exception $e) { echo 'caught exception: ', $e->getmessage(), "\n"; } mysqli_close($con); ?>
ajax
function getexample() { alert("test"); $.ajax({ type: "get", url: "code/getexample.php", datatype: "html", cache: false, success: function(response) { alert(response); } }); }
the alert test showing on webpage no errors far , file permissions except pass read , write , execute.
from experience, whats going wrong?
note: dont want send data , want retrieve json time being im testing datatype: 'html',.
i'm expecting hello appear alert nothing appears alerts test before ajax call. ( in reply comment)
* edit *
403 forbidden error... when set pass file read resets read , write... looks changing file permissions not work.
i found problem, might because webhost has selective policy on file permissions. folder , files needed selected file permissions , when used ftp seemed have messed configurations.
the lesson check file permissions ftp provider , avoid ftp clients ftp permissions.
when simple things dont work, nothing works , know darn well.
Comments
Post a Comment