1

Here following the working code,

$.get(ghost.url.api("posts", {
    "tag:'Category Name'"
})).done(function(data) {
    $.each(data.posts, function(i, post) {
        console.log(post);
    });
});

Now I want to add a variable there for the Category Name

So I used the following code,

var cat_name = "test";
$.get(ghost.url.api("posts", {
    "tag:'+cat_name'"
})).done(function(data) {
    $.each(data.posts, function(i, post) {
        console.log(post);
    });
});

But I am getting syntax error! How to resolve that? Where is my fault in that syntax?

Talha Awan
  • 4,573
  • 4
  • 25
  • 40
Md Nurullah
  • 472
  • 7
  • 21

0 Answers0