Looking to expand upon an existing empty JSON object.
After a couple of basic extensions, I end up with {size: 10, from: 0}
.
However, when attempting to use the $.extend function with multi-level JSON
"query" :
{ "query_string" :
{ "fields" : ["name", "description"],
"query" : "d.search.value",
"tie_breaker" : 0
}
}
I am facing difficulty achieving success.
data : function ( d ) {
var query = '{}';
sQuery = $.extend(query,{size: d.length});
sQuery = $.extend(sQuery,{from: d.start});
if ( d.search.value ) {
sQuery = $.extend(sQuery,
"query" : { "query_string" : { "fields" : ["name", "description"], "query" : "d.search.value", "tie_breaker" : 0 } }
);
console.log(sQuery);
};
return JSON.stringify(sQuery);
},
But I'm encountering a "
Uncaught SyntaxError: missing ) after argument list
" error.
I think I have overlooked something simple but cannot seem to pinpoint it.