posted on: 2008-08-30 10:12:17
Storyboard is using AJAX techniques, Here Ill post some techniques that pop up and I can't book mark. XHR request, Hidden Iframe Trick.

>To make a form submite without the whole page changing you might use an XHR, to do that you have to change the FORM data into URL encoded data, here is a java script function to do just such a thing.

function serializeForm(elForm) {
  var aParams = [];
  for (var oInputList = elForm.elements, i = 0, iLen = oInputList.length, el, sEncodedName; i < iLen; i++) {
    el = oInputList[i];
    if (el.name && !el.disabled) {
      sEncodedName = encodeURIComponent(el.name);
      if (el.type == 'select-multiple') {
        for (var iOption = 0, iTotalOptions = el.length; iOption < iTotalOptions; iOption++) {
          if (el[iOption].selected) {
            aParams.push(sEncodedName + '=' + encodeURIComponent(el[iOption].value));
          }
        }
      } else if ((el.type != 'radio' && el.type != 'checkbox') || el.checked) {
        aParams.push(sEncodedName + '=' + encodeURIComponent(el.value));
      }
    }
  }
  return aParams.join('&');
}

This code was provided by "makk" on ##javascript at irc.freenode.net.

Comments

Name: