ca87;10963626 wrote:
The problem is with the Ajax http-request function, while i needed 3 Ajax request
$heater = $_REQUEST['heater'];
$tableName = $_REQUEST['Pool_Shape'];
$selectedIndex = $_REQUEST['size_In_Feets'];
I'm not certain I understand what you mean. The php code shown above implies that you want one single ajax request which sends 3 values as either get or post data (or allready exist as session or cookie data). Personally I'd recommend specifying $_GET if you send a get request and $POST if you send a post request, and similarily $whatever if you have your data elsewhere. Especially since you can change the order of which of get, post, session and cookie overrides the other in case of them containing the same array elements in php.ini. See requet order for more info.
So, if you need to fallback to $SESSION if there is no $GET data, rather do
if (empty($_GET['key']) && empty($_SESSION['key'])) {
$val = 'default value';
}
else if (empty($_GET['key'])) {
$val = $_SESSION['key'];
}
else {
$val = deal_with_validation_and_escaping($_GET['key']);
}
As for sending multiple name/value pairs in one request, I'd change the string argument to multiple arguments
function showCostEstimate(heater, shape, size){
var queryString = '?heater='+window.encodeURIComponent(heater)+'&Pool_Shape='+window.encodeURIComponent(shape)+'&size_In_Feets='+window.encodeURIComponent(size);
loadXMLDoc("costEstimate.php"+queryString, function(){
ca87;10963626 wrote:
executed and parsed but i don't know how to make Ajax request for the 3 all at once.
Should you really need 3 ajax requests, you just
loadXMLDoc(...);
loadXMLDoc(...);
loadXMLDoc(...);
And as far as I can tell, your javascript should execute, so the question once again is: What happens server side? Have you checked your error log? Have you tried using error_log to do things like
<?php
error_log('ajax request started');
include("classes/DBConnection.php");
error_log(1);
include("classes/DBTable.php");
error_log(2);
$heater = $_REQUEST['heater'];
$tableName = $_REQUEST['Pool_Shape'];
$selectedIndex = $_REQUEST['size_In_Feets'];
error_log(print_r($_GET,1));
$connx = new DBConnection();
error_log(3);
$table = new DBTable($tableName, $selectedIndex, $connx);
error_log(4);
// ...