---
title: open
framework: tvmljs
role: symbol
role_heading: Instance Method
path: tvmljs/xmlhttprequest/1627318-open
---

# open

Sets the method, URL, and synchronous flag for a request.

## Declaration

```data
void open(
    in String method, 
    in String urlStr, 
    in optional int asyncNum, 
    in optional Object user, 
    in optional Object password
);
```

```data
void open(
    DOMString method, 
    DOMString url
);
```

## Parameters

- `method`: The HTTP method for the request. connect, trace, and track are invalid values.
- `urlStr`: The URL for the request.
- `asyncNum`: An integer value indicating if the request is asynchronous. 0 is a synchronous request. Any positive integer is an asynchronous request. The default value is 1.
- `user`: Not supported by Apple TV. This value must be set to null.
- `password`: Not supported by Apple TV. This value must be set to null.

## Discussion

Discussion This method initializes a request.

## See Also

### Initializing and Sending a Request

- [abort](tvmljs/xmlhttprequest/1627356-abort.md)
- [send](tvmljs/xmlhttprequest/1627309-send.md)
- [timeout](tvmljs/xmlhttprequest/1627335-timeout.md)
- [XMLHttpRequest](tvmljs/xmlhttprequest/1627350-xmlhttprequest.md)
