javascript - Getting Unexpected Token ILLEGAL JS Error -


i keep getting "unexpected token illegal" error when on script once registered on page.

  stringbuilder str = new stringbuilder();                  str.append("<script type='text/javascript'> function anotherfunction(evt) { ");                 str.append("var xhr = new xmlhttprequest();");                  str.append("var data = new formdata();");                 str.append("var files = $('#fileupload1').get(0).files;");                 str.append("for (var = 0; < files.length; i++){");                 str.append("data.append(files[i].name, files[i]);}");                 str.append("xhr.upload.addeventlistener('progress' , function (evt){");                 str.append("if (evt.lengthcomputable) {");                 str.append(" var progress = math.round(evt.loaded * 100 / evt.total);");                 str.append("$('#progressbar').progressbar('value', progress); }}, false);");                 str.append("  xhr.open('post', 'handler.ashx');");                 str.append("xhr.send(data); $('#progressbar').progressbar({");                 str.append(" max: 100,change: function (evt, ui){");                 str.append("$('#progresslabel').text($('#progressbar').progressbar('value') + '%');");                 str.append(" }, complete: function (evt, ui){");                 str.append("  $('#progresslabel').text('file upload successful!');' }});");                 str.append("evt.preventdefault(); }</script>");                   clientscriptmanager cs = page.clientscript;                 cs.registerstartupscript(this.gettype(), "refreshparent", str.tostring(), false); 

does have ideas on how can resolved?

there's ' in penultimate str.append() call.

change

str.append(" $('#progresslabel').text('file upload successful!');' }});");

to

str.append(" $('#progresslabel').text('file upload successful!'); }});");


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -