Can't get json data returned

Permalink
Can anyone please tell me if i'm missing something because i keep on struggling with it... My json data won't be outputted to the screen. I understood that most people make changes in the controller.php, view.php or so todo ajax with concrete5 but i'm in a little hurry and have not the time to go to deep into concrete. Can't it just be done inline ?

function ajaxFunction(){
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      jsonData = JSON.parse( xmlhttp.responseText );

 
4M8B replied on at Permalink Reply
Nobody suggestions?
JohntheFish replied on at Permalink Reply
JohntheFish
1. Use jQuery. What you trying to do is an $.get(), as per http://api.jquery.com/jQuery.get/....

2. You can only get an ajax response from a controller 'action' or a 'tools' file. Running an ajax request to anything else will either leave security holes or return an entire page. See http://www.concrete5.org/documentation/how-tos/developers/ajax-less... and http://www.concrete5.org/marketplace/addons/ajax-lessons/...
4M8B replied on at Permalink Reply
Ok i'll take a look at it... Thanks for the response ;-)