How to use the jquery.param 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 OpenBazaar / openbazaar-desktop / js / views / transactions / Transactions.js View on Github external
const orderDetail = new OrderDetail({
      model,
      removeOnClose: true,
      returnText: app.polyglot.t(`transactions.${type}s.returnToFromOrder`),
      ...opts.modalOptions,
    });

    orderDetail.render().open();

    if (opts.addToRoute) {
      // add the order / case id to the url
      const params = deparam(location.hash.split('?')[1] || '');
      delete params.orderId;
      delete params.caseId;
      params[type === 'case' ? 'caseId' : 'orderId'] = id;
      app.router.navigate(`${location.hash.split('?')[0]}?${$.param(params)}`);
    }

    // remove it from the url on close of the modal
    const onClose = () => {
      const params = deparam(location.hash.split('?')[1] || '');
      delete params.orderId;
      delete params.caseId;
      app.router.navigate(`${location.hash.split('?')[0]}?${$.param(params)}`);
    };

    this.listenTo(orderDetail, 'close', onClose);

    // Do not alter the url if the user is routing to a new route. The
    // user has already altered the url.
    this.listenTo(app.router, 'will-route', () => {
      this.stopListening(orderDetail, 'close', onClose);
github nusmodifications / nusmods / app / scripts / support / views / ChatView.js View on Github external
if ($container.length === 0) {
      return;
    }

    var params = {
      timezone: options.timezone,
      anonymous: options.anonymous,
      minimal: options.minimal
    };

    if (options.welcome) {
      /* jshint camelcase: false */
      params.welcome_msg = options.welcome;
    }

    var url = options.url + (options.url.indexOf('?') > 0 ? '&' : '?') + $.param(params);
    if (url.indexOf('https://') !== 0) {
      url = 'https://' + url;
    }
    var w = options.width || '100%';
    var h = options.height || 500;
    var nf = (options.noframes || '');
    $container.html('');
  }
}
github VisualComposer / builder / public / editor / modules / content / wordpress / storage / lib / wp-data-dom-store.js View on Github external
var ajaxPost = function(data, successCallback, failureCallback) {
  var request = new XMLHttpRequest();
  request.open('POST', window.vcAjaxUrl, true);
  request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  request.onload = function() {
    if (request.status >= 200 && request.status < 400) {
      successCallback(request);
    } else {
      if ('function' === typeof failureCallback) {
        failureCallback(request);
      }
    }
  };
  request.send($.param(data));
};
Data.subscribe('app:init', function() {
github oroinc / platform / src / Oro / Bundle / UIBundle / Resources / public / js / extend / select2.js View on Github external
prototype.prepareOpts = function(options) {
            if (options.collapsibleResults) {
                options.populateResults = populateCollapsibleResults;
                const matcher = options.matcher || $.fn.select2.defaults.matcher;
                options.matcher = function(term, text, option) {
                    return !option.children && matcher.call(this, term, text, option);
                };
            }

            const additionalRequestParams = options.element.data('select2_query_additional_params');
            if (additionalRequestParams && options.ajax !== undefined) {
                options.ajax.url += (options.ajax.url.indexOf('?') < 0 ? '?' : '&') + $.param(additionalRequestParams);
            }

            const preparedOptions = prepareOpts.call(this, options);
            const query = preparedOptions.query;

            preparedOptions.query = function(queryOptions, ...rest) {
                queryOptions.term = queryOptions.term && queryOptions.term.trim();
                return query.call(this, queryOptions, ...rest);
            };

            preparedOptions.populateResults = _.wrap(preparedOptions.populateResults,
                function(original, container, results, query) {
                    original.call(this, container, results, query);

                    const $results = $(container).find('.select2-result');
github NetEaseGame / Sentry / src / sentry / static / sentry / app / views / groupTagValues.jsx View on Github external
fetchData() {
    let params = this.props.params;
    let queryParams = this.props.location.query;
    let querystring = jQuery.param(queryParams);

    this.setState({
      loading: true,
      error: false
    });

    this.api.request('/issues/' + this.getGroup().id + '/tags/' + params.tagKey + '/', {
      success: (data) => {
        this.setState({
          tagKey: data,
          loading: this.state.tagValueList === null
        });
      },
      error: (error) => {
        this.setState({
          error: true,
github translate / pootle / pootle / static / js / editor / app.js View on Github external
let newHash = {};
      if (filterChecks.endsWith('-category')) {
        newHash = {
          filter: 'checks',
          category: filterChecks.slice(0, -9),
        };
      } else {
        newHash = {
          filter: 'checks',
          checks: filterChecks,
        };
      }
      if (sortBy !== 'default') {
        newHash.sort = sortBy;
      }
      $.history.load($.param(newHash));
    }
    return true;
  },
github NetEaseGame / Sentry / src / sentry / static / sentry / app / views / projectDashboard / topIssuePersonPieChart.jsx View on Github external
onChartClicked(params, chart) {
    if (params && params.dataIndex >= 0) {
      let root_url = '/' + this.props.params.orgId + '/' + this.props.params.projectId + '/?';
      let email = this.state.statsData[params.dataIndex].email;
      if (email) {
        let qs = jQuery.param({
          query: "assigned:" + email
        });
        window.open(root_url + qs, "_blank");
      }
    }
  },
  render() {
github WikiWatershed / model-my-watershed / src / mmw / js / src / core / models.js View on Github external
url: function(queryParams) {
        var encodedQueryParams = queryParams ? '?' + $.param(queryParams) : '';
        if (this.get('job')) {
            return '/' + this.get('taskType') + '/jobs/' + this.get('job') + '/';
        } else {
            return '/' + this.get('taskType') + '/' + this.get('taskName') + '/' + encodedQueryParams;
        }
    },
github NetEaseGame / Sentry / src / sentry / static / sentry / app / views / projectReleases / index.jsx View on Github external
getProjectReleasesEndpoint() {
    let params = this.props.params;
    let queryParams = {
      ...this.props.location.query,
      limit: 50,
      query: this.state.query
    };

    return '/projects/' + params.orgId + '/' + params.projectId + '/releases/?' + jQuery.param(queryParams);
  },
github ngageoint / mage-server / public / app / admin / events / event.edit.form.feed.controller.js View on Github external
function getObservationIconUrlForEvent(eventId, formId, primary, variant) {
    var url = '/api/events/' + eventId + '/icons';

    if (formId) {
      url += '/' + formId;
    }

    if (primary) {
      url += '/' + primary;
    }

    if (variant) {
      url += '/' + variant;
    }

    return url + '?' + $.param({access_token: LocalStorageService.getToken()});
  }