Question: I am trying to get data from a php sub-page.
Using javascript, I have tried to use :

```js
var items = document.querySelectorAll('option');
console.log("length : "+items.length);
```

```html
  <option value="75">item-127 ( 120127 )</option>
  <option value="74">item-163 ( 0 )</option>
  <option value="94">item-139 ( 0 )</option>
  <option value="89">item-135 ( 0 )</option>
  <option value="369">Item-AC95 ( AC95 )</option>
  <option value="63">item-159 ( 120159 )</option>
```

But it does not return the expected length:
length : 0
How could I do it?

The final expectation is having a table with values and items

thanks

Answer: 
It's error because of 

> 
> The expected message formats for the operation are 'Xml', 'Json'.
>  So you can pass contentType in your ajax call
> 
> 
> 

```
$.ajax({
 ....,

  contentType: "application/json"
})

```
Instead of this 

```
 var postData = JSON.stringify(companyValue);

```

why don't you try this:

```
var obj ={token :token ,companyValue:companyValue }

```

And then make use of the json stringify function

```
 var postData = JSON.stringify(obj);

```

After that in ajax call only change the url:

```
url: "http://webservice/CompanySave/"

```