I'm trying to make maybe the simplest jQuery's getJson function and I'm facing some problems..
my script:
<script>
$(document).ready(function()
{
$.getJSON('http://localhost:8000/api/tests', function(Results)
{
document.write(Results.name);
});
});
</script>
I have tried to include jquery.js with multiple different ways. for example:
<script src="../js/jquery.js"></script>
<script src="https//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
Localhost:8000/api/tests prints out: [{"id" :1, "name":"test", "description":"testtext"}]
in app/config I have
assetic:
assets:
jquery: "%kernel.root_dir%/.../vendor/components/jquery/jquery.min/js"
Probably nothing to do with this but if I add - front of the jquery ERROR: "The attribute "name" must be set for path "assetic.assets"
Current result: undefined
Any tips how I make it display result as I want.. in this case instead of undefined it should be test
Hopefully you understand my question. Thanks for your time!