Hallo,

In mijn template gebruik ik de volgende code:



$.post('/site/ajax/pay.php',
{
name: $('input[name="name"]').val(),
url: $('input[name="url"]').val(),
category: '<?php echo $_GET['var']; ?>',
description: $('input[name="description"]').val()
},
function (data)
{
var obj = jQuery.parseJSON(data);
if(obj.type == "success")
{
$('#status').html(createHtml('success', LANG['link_submit'])).show();
$('#content_wrap').hide();
}
else
{
$('#status').html(createHtml('error', obj.message)).show();
}
});

});


In ajax/pay.php staat het volgende:

<?php


$ajax = true;
require_once('../top.php');


if(empty($_POST['name']) || empty($_POST['url']) || empty($_POST['category']))
{
echo json_encode(array('type' => 'error', 'message' => __('Please fill in all fields')));
exit;
}


if($directory['merchant'] == 'mollie')
{
require(ROOT . '/lib/mollie/mollie.php');

$m = new micropayment();

$m->setPartnerID($directory['merchant_id']);


$m->setAmount($directory['price']);

if(!empty($_SESSION['servicenumber']) && !empty($_SESSION['paycode']))
{
$m->setServicenumber($_SESSION['servicenumber']);
$m->setPaycode($_SESSION['paycode']);
$m->checkPayment();

if ($m->payed)
{
$payed = true;
}
}
}
else if($directory['merchant'] == "targetpay")
{
require(ROOT . '/lib/targetpay/targetpay.php');

if (isset ( $_SESSION['number'] ) && isset ( $_SESSION['code'] ) )
{
$oIvr = new TargetPayIvr ( $directory['merchant_id'] );
$oIvr->setDomain ( 'www.'.$settings['url']);

if ( $oIvr->validatePayment ( $_SESSION['number'], $_SESSION['code'] ) == true )
{
$payed = true;
}
}
}
else if($directory['merchant'] == "paypal")
{
if($directory['pay_approve'] == 1)
{
$new1 = '1';
$active1 = '0';
}
else
{
$new1 = '0';
$active1 = '1';
}
$_SESSION['name'] = $_POST['name'];
$_SESSION['description'] = $_POST['description'];
$_SESSION['url'] = $_POST['url'];
$_SESSION['category'] = $_POST['category'];
$_SESSION['new'] = $new1;
$_SESSION['active'] = $active1;

$payed = true;
}





if(!isset($payed))
{
echo json_encode(array('type' => 'error', 'message' => __('You did not have called yet')));
exit;
}


if($directory['pay_approve'] == 1)
{
$new = '1';
$active = '0';
}
else
{
$new = '0';
$active = '1';
}


$sql = '
INSERT INTO
' . $dbPrefix . 'link
(
id_directory,
title,
description,
cat_id,
link,
new,
active
)
VALUES
(
:id_directory,
:title,
:description,
:cat_id,
:link,
:new,
:active
);';

$stmt = $db->prepare($sql);
$stmt->bindParam(':id_directory', $directory['id'], PDO::PARAM_INT);
$stmt->bindParam(':title', $_POST['name'], PDO::PARAM_STR);
$stmt->bindParam(':description', $_POST['description'], PDO::PARAM_STR);
$stmt->bindParam(':link', $_POST['url'], PDO::PARAM_STR);
$stmt->bindParam(':cat_id', $_POST['category'], PDO::PARAM_INT);
$stmt->bindParam(':new', $new, PDO::PARAM_INT);
$stmt->bindParam(':active', $active, PDO::PARAM_INT);


$stmt->execute();


if($directory['pay_approve'] == 1)
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $settings['site_name'] . ' <' . $settings['email'] . '>' . "\r\n";

ob_start();
include(TEMPLATE_PATH . 'email/link.html');
$message = ob_get_clean();

mail($directory['email'], __('A payed link submit'), $message, $headers);
}


echo json_encode(array('type' => 'success'));



Internetexplorer en Chrome werken met deze code perfect, Firefox weigert de dienst er komt geen data aan wat bij de andere browsers wel het geval is.
Ik heb al een paar keer geprobeerd de contentType application/json en dataType Json toe te voegen echter zonder succes. Firefox blijft weigeren.

Heeft iemand een idee waarom het bij firefox mis gaat? Het rare is dat ik ook geen foutmelding in firebug krijg.