user1934044
user1934044

Reputation: 516

ajax or jquery post json request

I'm trying to make post json call but it is showing call type "text/html" in develepors tools

here is my ajax and jquery call both of them posting same call

var dataString='query='+search_value;
        $.ajax({
            url: '/reports/search', 
            type: 'post',
            dataType: 'json',
            data: dataString,
            success:function(data){
                console.log("success"+data);
            }
        });

jquery
        $.post( "/reports/search", { query: search_value},function(data) {
            console.log(data);
          },"json");

here is the screenshot of the request

what's wrong with my request enter image description here

Upvotes: 0

Views: 91

Answers (1)

Wit Wikky
Wit Wikky

Reputation: 1542

 var dataString='query='+search_value;
    $.ajax({
        url: 'yourbase url'+'/reports/search', 
        type: 'post',

You have to define your base URL or proper URL to make Ajax call.

Upvotes: 1

Related Questions