How to use the jquery.post function in jquery

To help you get started, we’ve selected a few jquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conveyal / gtfs-data-manager / public / new_client / app / app.js View on Github external
getProfile(token) {
    // retreive the user profile from Auth0
    $.post('https://' + config.auth0Domain + '/tokeninfo', { id_token: token })
      .done((profile) => {
        this.userLoggedIn(token, profile)
      })
  }
github VIDA-NYU / domain_discovery_tool / client / src / components / SearchTabs.js View on Github external
runMutipleQuery(queries, previous_valueQuery, updateView){
      var valueQuery = queries[queries.length-1];
      queries.pop();
      //Submits a web query for a list of terms, e.g. 'ebola disease'
        var session =this.props.session;
        session['search_engine']=this.state.search_engine;
        session['pagesCap'] = this.state.pages_search_engine;
        var concat_valueQuery = (previous_valueQuery!=='')?previous_valueQuery:valueQuery;
        if(updateView==1) {
          session = this.resetAllFilters(session);
          this.props.getQueryPages(concat_valueQuery);
        }
        updateView=updateView+1;
        if(valueQuery!==""){
          $.post(
            '/queryWeb',
            {'terms': valueQuery,  'session': JSON.stringify(session)},
            function(data) {
                if(queries.length==0) this.props.queryPagesDone();
                this.props.updateStatusMessage(false, 'Searching: Web query "' + valueQuery + '" is completed');
                if(queries.length>0) this.runMutipleQuery(queries, concat_valueQuery, updateView);
            }.bind(this)).fail(function() { console.log("Something is wrong. Try again.");
                                            this.props.updateStatusMessage(false, 'Searching: Web query "' + valueQuery + '" has failed');
                                            if(queries.length>0){
                                               this.runMutipleQuery(queries, previous_valueQuery, updateView);
                                            }
                                          }.bind(this));
            this.props.updateStatusMessage(true, 'Searching: Web query "' + valueQuery + '"');
          }
          else{
            if(queries.length>0) this.runMutipleQuery(queries, previous_valueQuery, updateView);
github spchuang / fb-local-chat-bot / localChatWeb / js / src / LocalChatStore.js View on Github external
sendQuickReplyForUser(senderID: string, text: string, payload: string): void {
    const url = this._baseURL + '/localChat/quickReply';
    $.post(url, {senderID: senderID, text: text, payload: payload})
      .fail((res: Object) => {
        console.log(res);
      });
  }
github VIDA-NYU / domain_discovery_tool / client / src / components / FiltersTabs.js View on Github external
getAnnotatedTerms(){
    $.post(
      '/getAnnotatedTerms',
      {'session': JSON.stringify(this.props.session)},
      function(terms) {
        var selected_aterms = [];
        if(this.props.session['selected_aterms'] !== undefined && this.props.session['selected_aterms'] !== ""){
          selected_aterms = this.props.session['selected_aterms'].split(",");
        }
        this.setState({currentATerms: terms, session:this.props.session, checked:selected_aterms});
      }.bind(this)
    );
  }
github Laverna / laverna / app / scripts / models / Signal.js View on Github external
async auth() {
        const key = openpgp.key.readArmored(this.user.publicKey).keys[0];
        const res = await $.get(`${this.options.api}/token/${this.user.username}`);
        const signature = await this.createSignature(res);

        log('signature is', {signature});
        const data = {
            signature,
            fingerprint : key.primaryKey.fingerprint,
            username    : this.user.username,
        };

        return $.post(`${this.options.api}/auth`, data);
    }
github invinst / CPDB / dashboard / static / dashboard / js / utils / AliasAPI.js View on Github external
create: function (alias, target) {
    if (ajax) {
      ajax.abort();
    }

    ajax = jQuery.post(AppConstants.ALIAS_API_ENDPOINT, {alias: alias, target: target}).done(function (data) {
      AddAliasModalServerActions.receivedAliasCreationResult(data);
    }).fail(function (error) {
      AddAliasModalServerActions.failedToCreateAlias(error.responseJSON);
    });
  }
};
github omgimanerd / nycurl / client / js / analytics.js View on Github external
$(document).ready(() => {
  const dateSlider = document.getElementById('date-slider')
  $.post('/analytics', data => {
    if (data.length == 0) {
      window.alert('No data!')
    }
    /**
     * Initialize the c3 charts on the page with the analytics data.
     */
    const trafficChart = c3.generate({
      bindto: '#traffic',
      axis: {
        x: { padding: 0, type: 'timeseries' },
        y: { label: 'Requests', min: 0, padding: 0 }
      },
      data: {
        x: 'date',
        columns: getTrafficData(data)
      },
github OpenBazaar / openbazaar-desktop / js / views / modals / Settings / Advanced.js View on Github external
resynchronize() {
    this.getCachedEl('.js-resync').addClass('processing');
    this.getCachedEl('.js-resyncComplete').addClass('hide');

    this.resync = $.post(app.getServerUrl('wallet/resyncblockchain'))
      .always(() => {
        this.getCachedEl('.js-resync').removeClass('processing');
      })
      .fail((xhr) => {
        if (xhr.statusText === 'abort') return;
        const failReason = xhr.responseJSON && xhr.responseJSON.reason || '';
        openSimpleMessage(
          app.polyglot.t('settings.advancedTab.server.resyncError'),
          failReason);
      })
      .done(() => {
        this.getCachedEl('.js-resyncComplete').removeClass('hide');
      });
  }
github frankhale / toby / src / react-components / toby-ui.tsx View on Github external
private onUpdateVideoButtonClick(video: IVideoEntry, group: string): void {
    let found = _.find(this.state.searchResults, { ytid: video.ytid });

    if (found !== undefined) {
      found.isArchived = true;
      found.title = video.title;

      $.post({
        url: "/api/videos/update",
        data: {
          title: video.title,
          ytid: video.ytid,
          group: group !== undefined ? group : "misc"
        }
      });
    }
  }
  private onDeleteVideoButtonClick(video: IVideoEntry): void {