3

I have the following jQuery/JS setup. It works fine but I'm curious if there's a way to shorten it. I've tried a few different ways but I keep getting unassigned function errors. Is this just not possible yet?

switch(loadtype){
case 'html':
    ajaxcon.html(ret);
    break;
case 'prepend':
    ajaxcon.prepend(ret);
    break;
case 'append':
    ajaxcon.append(ret);
    break;
}

Is there a way that I could do this instead?

ajaxcon.loadtype(ret);
Anders
  • 8,307
  • 9
  • 56
  • 88
b3tac0d3
  • 899
  • 1
  • 10
  • 15

0 Answers0