當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。