1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-26 14:27:04 +00:00
Gerasimos Maropoulos
2016-09-15 18:59:27 +03:00
parent 7ea334812f
commit 741ecbf2fb
5 changed files with 16 additions and 4 deletions

View File

@@ -277,6 +277,13 @@ func (ctx *Context) RequestHeader(k string) string {
return utils.BytesToString(ctx.RequestCtx.Request.Header.Peek(k))
}
// IsAjax returns true if this request is an 'ajax request'( XMLHttpRequest)
//
// Read more at: http://www.w3schools.com/ajax/
func IsAjax() bool {
return (c.RequestHeader("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest")
}
// FormValueString returns a single value, as string, from post request's data
func (ctx *Context) FormValueString(name string) string {
return string(ctx.FormValue(name))