当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript jQuery.post函数代码示例

本文整理汇总了TypeScript中jQuery.post函数的典型用法代码示例。如果您正苦于以下问题:TypeScript post函数的具体用法?TypeScript post怎么用?TypeScript post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了post函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

    MESSAGES_POST: (store, action) => {
        var msg = action.message,
            state = store.getState(),
            parts,
            to = null,
            activeSub = state.activeSub;

        if (msg) {
            store.dispatch({ type: 'MESSAGEHISTORY_ADD', message: msg });
        }

        if (msg[0] === "@") {
            parts = $.ss.splitOnFirst(msg, " ");
            var toName = parts[0].substring(1);
            if (toName === "me") {
                to = activeSub.userId;
            } else {
                const toUser = state.users.filter(user => user.displayName === toName.toLowerCase())[0];
                to = toUser ? toUser.userId : null;
            }
            msg = parts[1];
        }
        if (!msg || !activeSub) return;
        const onError = e => {
            if (e.responseJSON && e.responseJSON.responseStatus)
                store.dispatch({ type: 'ERRORS_SHOW', message: e.responseJSON.responseStatus.message });
        };

        if (msg[0] === "/") {
            parts = $.ss.splitOnFirst(msg, " ");
            $.post(`/channels/${state.selectedChannel}/raw`, {
                from: activeSub.id,
                toUserId: to,
                message: parts[1],
                selector: parts[0].substring(1)
            },
                () => { }
            ).fail(onError);
        } else {
            $.post(`/channels/${state.selectedChannel}/chat`, {
                from: activeSub.id,
                toUserId: to,
                message: msg,
                selector: "cmd.chat"
            },
                () => { }
            ).fail(onError);
        }

        store.dispatch({ type: 'VALUE_SET', value: '' });
    }
开发者ID:ServiceStackApps,项目名称:ReactChat,代码行数:51,代码来源:reducers.ts

示例2: dirname

			btnLeft.on('click', () => {
				const url = this.getUrl();
				$.post('/fotoalbum/roteren' + dirname(url), {
					foto: basename(url),
					rotation: -90,
				}, reload);
			});
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:7,代码来源:FotoAlbum.ts

示例3: addOnlineMedia

  /**
   * @param {JQuery} $trigger
   * @param {string} url
   */
  private addOnlineMedia($trigger: JQuery, url: string): void {
    const target = $trigger.data('target-folder');
    const allowed = $trigger.data('online-media-allowed');
    const irreObjectUid = $trigger.data('file-irre-object');

    NProgress.start();
    $.post(
      TYPO3.settings.ajaxUrls.online_media_create,
      {
        url: url,
        targetFolder: target,
        allowed: allowed
      },
      (data: Response): void => {
        if (data.file) {
          window.inline.delayedImportElement(irreObjectUid, 'sys_file', data.file, 'file');
        } else {
          const $confirm = Modal.confirm(
            'ERROR',
            data.error,
            Severity.error,
            [{
              text: TYPO3.lang['button.ok'] || 'OK',
              btnClass: 'btn-' + Severity.getCssClass(Severity.error),
              name: 'ok',
              active: true
            }]
          ).on('confirm.button.ok', (): void => {
            $confirm.modal('hide');
          });
        }
        NProgress.done();
      }
    );
  }
开发者ID:mblag,项目名称:TYPO3.CMS,代码行数:39,代码来源:OnlineMedia.ts

示例4: stopDrag

	function stopDrag() {
		if (!dragObject.el) {
			return;
		}
		window.removeEventListener('mousemove', mouseMoveHandler, true);
		if (dragged) {
			const instance = dragObject.el;
			let top;
			let left;
			if (instance.hasClass('dragvertical') || instance.hasClass('draghorizontal')) {
				top = instance.scrollTop();
				left = instance.scrollLeft();
			} else {
				const offset = instance.offset() || {top: 0, left: 0};
				top = offset.top - docScrollTop();
				left = offset.left - docScrollLeft();
			}
			$.post('/tools/dragobject', {
				coords: {left, top},
				id: instance.attr('id'),
			});
			dragged = false;
		}
		dragObject.el = undefined;
	}
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:25,代码来源:dragobject.ts

示例5: setTimeout

			setTimeout(() => {
				$.post(tableConfig.ajax.url(), {
					lastUpdate: fnGetLastUpdate($table),
				}, (data) => {
					fnUpdateDataTable($table.attr('id')!, data);
					fnAjaxUpdateCallback($table)(data);
				});
			}, timeout);
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:8,代码来源:api.ts

示例6: setInterval

		setInterval(() => {
			const pingValue = $textarea.val() !== $textarea.attr('origvalue');
			if (pingValue || lastPing) {
				$.post($concept.attr('data-url')!, {
					ping: pingValue,
				}).done(domUpdate);
				lastPing = pingValue;
			}
		}, 60000);
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:9,代码来源:forum.ts

示例7: positionSave

	function positionSave(position: Position) {
		if (!previousPos || previousPos.coords === position.coords) {
			previousPos = position;
			$.post('/geolocation/save', {
				coords: position.coords,
				timestamp: Math.round(position.timestamp / 1000),
			});
		}
	}
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:9,代码来源:csrdelft.ts

示例8: saveCoords

	function saveCoords() {
		$.post('/tools/dragobject', {
			coords: {
				left: elmnt.scrollLeft(),
				top: elmnt.scrollTop(),
			},
			id: 'zijbalk',
		});
		trigger = false;
	}
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:10,代码来源:csrdelft.ts

示例9: updateTitle

	function updateTitle() {

		const nu = new Date();
		let seconds = Math.floor((nu.getTime() - starttijd.getTime()) / 1000);
		const minutes = Math.floor(seconds / 60);

		seconds = seconds % 60;

		document.title = goed + '/' + beurten + ' (' + minutes + ':' + (seconds < 10 ? '0' : '') + seconds + ')';

		if (!finished) {
			return setTimeout(updateTitle, 1000);
		}
		// einde: stop de tijd

		const dialog = {
			buttons: {},
			height: 334,
			modal: true,
			resizable: false,
			width: 484,
		};
		let content = 'Gefeliciteerd! U heeft alle ' + goed + ' namen goed in ' + beurten + ' beurten';
		content += ' en heeft daar in totaal ' + minutes + ' minuten en ' + seconds + ' seconden over gedaan.';

		if (!learnmode) {
			content += '<p>Wilt u deze score toevoegen aan de lijst met hoogste scores?</p>' +
				'<input name="eerlijk" id="eerlijk" type="checkbox" />' +
				'<label for="eerlijk"> Ik heb deze score eerlijk verkregen</label>';

			let eerlijk = false;
			$(document).on('change', '#eerlijk', function () {
				eerlijk = this.checked;
			});

			dialog.buttons = {
				Ja() {
					$.post('/leden/memoryscore/', {
						beurten,
						eerlijk: eerlijk ? 1 : 0,
						goed,
						groep: $('body').data('groep'),
						tijd: minutes * 60 + seconds,
					});
					$(this).dialog('close');
				},
				Nee() {
					$(this).dialog('close');
				},
			};
		}
		$('<div id="dialog-finish" class="blue">' + content + '</div>').appendTo('body');

		$('#dialog-finish').dialog(dialog);
	}
开发者ID:csrdelft,项目名称:csrdelft.nl,代码行数:55,代码来源:ledenmemory.ts


注:本文中的jQuery.post函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。