Skip to content

Commit c0eeb8a

Browse files
Update README.md
1 parent 7cf4f82 commit c0eeb8a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,39 @@ Example:
228228
st<body>=...$[ln]; <input name="TextBox" id="TextBox" type="text" />$[ln];...
229229
as<body>=background-color:green
230230
```
231+
232+
## PostBack and GetBack method
233+
234+
`PostBack` and `GetBack` are two methods in WebFormsJS.
235+
236+
`PostBack` requests the URL string in the condition that it also transfers the input data to the server. The `PostBack` method should only be used inside a form tag. The `PostBack` method is automatically activated on submit type inputs.
237+
238+
`GetBack` only requests the URL string regardless of the input data. The URL string can also contain the query string. The `GetBack` method can be used without the form tag on the page.
239+
240+
There are three overloads for the `GetBack` method:
241+
242+
- **`GetBack()`:** Requests the current URL path executed in the browser.
243+
- **`GetBack(this)`:** should be used only in situations where the form tag must be present on the page. If executed inside a form, the action path requests the form, otherwise it requests the path of the first form on the page.
244+
- **`GetBack("YourURL")`:** Requests the URL path entered as an argument.
245+
246+
Calling WebFormJS in HTML pages causes submit buttons to automatically get the onclick attribute with `PostBack(this)` value.
247+
248+
`<input name="btn_Button" type="submit" value="Click to send data" onclick="PostBack(this)"/>`
249+
250+
If you call the `PostBack` method as below, the contents of the page will remain and the values ​​will be added to the beginning of the inner content of the body tag.
251+
252+
`PostBack(this, true)`
253+
254+
You can specify where to add content instead of true.
255+
256+
Example1:
257+
258+
`PostBack(this, "<div>2")`
259+
The above method places the data received from the server inside the third `div` tag.
260+
261+
Example2:
262+
263+
`PostBack(this, "MyTagId")`
264+
The above method puts the data received from the server inside a tag or `MyTagId` id.
265+
266+
> Note: Examples 1 and 2 for the `GetBack` method also have the same function.

0 commit comments

Comments
 (0)