0

I want to fetch the json data from function and not file.

How can i change the autocomplete.php to a PHPfunction?

My code:

<html>
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

<script>
$(function() {
    $( "#skills" ).autocomplete({
        source: 'autocomplete.php'
    });
});
</script>
</head>
<body>
<div class="ui-widget">
    <label for="skills">Skills: </label>
    <input id="skills">
</div>
</body>
</html>
sdfgg45
  • 1,232
  • 4
  • 22
  • 42

1 Answers1

0

Add get or post parameter to your ajax, for example action=func1 and in your php file make a switch and in the case of action is "func1" just call func1().

Martin Joó
  • 325
  • 1
  • 11