I′ve got a javascript method that calls a php method to get some data in the array "availabletags". To prove if the function is even called, I added
availableTags[0] = "Test";
When I put it on my server to try it, nothings happens. So I think the javascript function isn′t called.
<link rel="stylesheet" href="js/demos.css">
<script type="text/javascript">
$(function() {
var availableTags = new Array(400);
availableTags[0] = "Test";
availableTags = JSON.parse(<?php echo '"'.addslashes(include("/php/search_new.php")).'"'; ?>);
for(var i=0;i<availableTags.length;i++){
alert("<b>availableTags["+i+"] is </b>=>"+availableTags[i]+"<br>");
}
}
</script>
</head>
<body>
<input id="searchrecipes" type="text" name="searchrecipes" class="searchinput" style="margin-left: 850px; margin-top: 0px; width:170px; background: #fff url(images/search_icon.png) no-repeat 100%;" placeholder="Suchen..."></input>
<input type="submit" name="buttonsenden" style="display:none;" value="" width: 5px></input>
</body>
</html>
Does anybody know my mistake?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…