1
I put an Else in my php function and it’s falling into 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 access the file directly 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 it to an ajax it does not return me 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 ajax: utm_medium: Undefined utm_source: Undefined utm_campaign: Undefined
Ever tried to put
dataType:"json",in Ajax?– Sam
I posed, I managed to resolve the issue, but I had to use other methods.
– Gustavo Souza