Skip to content

Instantly share code, notes, and snippets.

View rose-pace's full-sized avatar

Rose Pace rose-pace

  • Avantia, Inc
  • Valley View, Ohio
View GitHub Profile
@rose-pace
rose-pace / UrlHelper.js
Last active June 18, 2018 15:05
JavaScript helper object for dealing with urls
var UrlHelper = function (location) {
this.protocol = '';
this.host = '';
this.path = '';
this.queryValues = {};
this.initQueryValues = function (search) {
var vals = {};
if (search) {
@rose-pace
rose-pace / postToDotNet.js
Last active October 5, 2016 20:30
Converts JSON data into MVC .Net consumable fields and synchronously posts to a set path.
// Performs a synchronous post that changes json to .Net consumable post fields
// this will send the page to the path specified as if it was a normal form post
function postToDotNet(path, params) {
var form = document.createElement("form"),
createFields = function (data, fieldPrefix) {
if (fieldPrefix === undefined) fieldPrefix = '';
if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
createFields(data[i], fieldPrefix + '[' + i + ']');
}