I placed an else in my function in php and it is falling on the else, but I have parameters to get from the url.
I have the following code in php:
$utm_source = $_REQUEST['utm_source'];
$utm_campaign = $_REQUEST['utm_campaign'];
$utm_medium = $_REQUEST['utm_medium'];
if($utm_source != '' || $utm_campaign != '' || $utm_medium != '')
{
$x['x'] = $utm_source;
$x['y'] = $utm_campaign;
$x['k'] = $utm_medium;
echo json_encode($x);
}
When I directly access the file through the browser with the parameters? utm_source = xesquedele & utm_medium = site & utm_campaign = partners it returns me:
{"x":"xesquedele","y":"parceiros","k":"site"}
But when I try to return this to an ajax it does not return anything or undefined.
$j(document).ready(function()
{
$j.ajax({
url: '/inchoo_quoteitemrule/ajax/sessiondesconto',
method: "POST",
success: function(retorno)
{
console.log(retorno);
alert('utm_medium: '+retorno['k']+' utm_source: '+retorno['x']+' utm_campaign: '+retorno['y']);
}
});
});
Return of ajax: utm_medium: undefined utm_source: undefined utm_campaign: undefined