Skip to content

Instantly share code, notes, and snippets.

@nozzlegear
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save nozzlegear/17a8197924be9f26a0eb to your computer and use it in GitHub Desktop.

Select an option

Save nozzlegear/17a8197924be9f26a0eb to your computer and use it in GitHub Desktop.
TypeScript definition file for $.postJson
/// <reference path="../typings/jquery/jquery.d.ts" />
// Extend the jQueryAjaxSettings interface that should be defined at /scripts/typings/jquery/jquery.d.ts
// Don't have that file? Install with NuGet: install-package jquery.typescript.definitelytyped
interface JQueryAjaxSettings {
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
* @param antiForgeryToken An ASP.NET AntiForgeryToken string. Will be sent in request headers as __RequestVerificationToken.
*/
postJson(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, antiForgeryToken?: string, dataType?: string): JQueryXHR;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment