Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'imageSrc' of undefined #88

Open
djonthenet opened this issue Dec 22, 2017 · 0 comments
Open

Comments

@djonthenet
Copy link

Hi when I hard code json in a variable javascript everything goes ok , when I send Json php array with json_encode method, ddslick catch this error

PHP

`$arrayITA = array( "text" => "Italiano", "value" => "1", "selected" => "1", "imageSrc" => "imgs/italy.png" );
$arrayGER = array( "text" => "Deutsche", "value" => "2", "selected" => "0", "imageSrc" => "imgs/germany.png" );
$arrayENG = array( "text" => "English", "value" => "3", "selected" => "0","imageSrc" => "imgs/english.png" );

$arroutput = array($arrayITA);

switch ($countLingue){
case 2 : array_push($arroutput, $arrayGER); break;
case 3 : array_push($arroutput, $arrayENG); break;
default : break;
}

echo json_encode($arroutput);`

javascript

var items = JSON.parse(jsonstring);

$('#flagselect').ddslick({
data: items,
width: 200,
imagePosition: "left",
onSelected: function (data) {
//console.log(data);
//mettere il value in sessione
//FIXME change language
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant