# How can I use bulk api with ajax and json file

**URL:** <https://discuss.elastic.co/t/how-can-i-use-bulk-api-with-ajax-and-json-file/41882>\
**Category:** Elasticsearch\
**Created:** [February 16, 2016, 12:25pm UTC](https://discuss.elastic.co/t/how-can-i-use-bulk-api-with-ajax-and-json-file/41882 "2016-02-16T12:25:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustafa\_Ali\_AKCA](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mustafa\_Ali\_AKCA](https://discuss.elastic.co/u/Mustafa_Ali_AKCA)\
**Post date:** [February 16, 2016, 12:25pm UTC](https://discuss.elastic.co/t/how-can-i-use-bulk-api-with-ajax-and-json-file/41882/1 "2016-02-16T12:25:58Z")

</div>

Hello,

I want to use bulk api with ajax. I want to take data from a json file in server.

How can I take data from an json url ?

$.ajax({  
type: "POST",  
async: false,  
url: '[http://localhost:9200/test/\_bulk](http://localhost:9200/test/_bulk)',  
data: data, // When I write a json file name it doesnt work example test.json  
dataType: "json",  
contentType: "application/text; charset=utf-8",  
success: function(text) {

```
         },
         error: function(err) {
             
         }
     });

```

thanks a lot

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:16pm UTC](https://discuss.elastic.co/t/how-can-i-use-bulk-api-with-ajax-and-json-file/41882/2 "2017-07-05T23:16:02Z")

</div>


