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 #14

Closed
aramhakobyan opened this issue Mar 15, 2018 · 2 comments
Closed
Labels

Comments

@aramhakobyan
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
}
});

@aramhakobyan
Copy link
Author

jquery v2 and higher

@oizulain
Copy link
Collaborator

oizulain commented Aug 27, 2018

@aramhakobyan It looks like the jsonstring you were passing was incorrect. I take it you probably fixed this issue by now?

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

No branches or pull requests

2 participants