Store ajax response in json file with Mockjax

141 views Asked by At

I am currently doing an exercise on jQuery, Mockjax, Ajax and JSON. but it seems that Mockjax doesn't work perfectly. Here is what I am trying:

function mockJaxTest(param){
  var url_pos = "http://localhost:8080/project/dashboard/"+param+".htm";
  $.mockjax({
     url: url,
     dataType: 'json',
     contentType: 'application/json',
     proxy: "resources/mocks/data-pos.json"
  });

  $.getJSON(url_pos, function(data) {
    if (data) {
      alert('SUCCESS');
    } else {
      alert('FAILED');
    }
  });
}

What am I doing wrong?

0

There are 0 answers