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: 
You need to set the content type header in your request to inform the server you're sending the data as JSON. 

The error message is telling you that the server does not understand the content you're sending it - you have to give it a hint that the data is in a particular format, especially because, again as mentioned in the error message, it allows you to submit in more than one different format (JSON or XML in this case).

Adding

```
contentType: "application/json"

```

to the options in your $.ajax call should resolve the issue.

P.S. We can't see the signature of your controller method but it's possible you may also need to give your parameter a name within the JSON, e.g. something like `data: JSON.stringify({ "companyValue": postData });` , but there's not enough info in your question to say for certain what the correct structure should be.
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/"

```