jquery string syntax

Discussion in 'jQuery' started by ernest1a, Jun 10, 2009.

  1. #1
    I would like to
    $('string').appendTo('#include_to');
    Code (markup):
    where the string is
    
    <div><p><input type="file" name="filename" onchange="ajaxUpload(this.form,'scripts/ajaxupload.php?filename=name&amp;maxSize=9999999999&amp;maxW=200&amp;fullPath=/jquery/uploads/&amp;relPath=../uploads/&amp;colorR=255&amp;colorG=255&amp;colorB=255&amp;maxH=300','upload_area','File Uploading Please Wait...&lt;br /&gt;&lt;img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' /&gt;','&lt;img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /&gt; Error in Upload, check settings and path info in source code.'); return false;" /></p><div>
    
    Code (markup):
    My question is how to write quotations '. I have tried almost everythings (',",/',/") and nothing works. So how to mix this string into code.

    tnx
     
    ernest1a, Jun 10, 2009 IP
  2. clarky_y2k3

    clarky_y2k3 Well-Known Member

    Messages:
    114
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    108
    #2
    You can escape single quotations using a backslash (\). Double quotes will not need to be escaped.
     
    clarky_y2k3, Jun 10, 2009 IP
  3. ernest1a

    ernest1a Guest

    Messages:
    182
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have a problem with a line before last one. The error is missing ) after argument list ajaxUpload(this.form,'scripts/ajaxupload...it...<br /><img width='128' height='15'

    $("<div><form action=\"scripts/ajaxupload.php\" method=\"post\" name=\"sleeker\" id=\"sleeker\" enctype=\"multipart/form-data\">"
    	+"<input type=\"hidden\" name=\"maxSize\" value=\"9999999999\" />"
    	+"<input type=\"hidden\" name=\"maxW\" value=\"200\" />"
    	+"<input type=\"hidden\" name=\"fullPath\" value=\"/jquery/uploads/\" />"
    	+"<input type=\"hidden\" name=\"relPath\" value=\"../uploads/\" />"
    	+"<input type=\"hidden\" name=\"colorR\" value=\"255\" />"
    	+"<input type=\"hidden\" name=\"colorG\" value=\"255\" />"
    	+"<input type=\"hidden\" name=\"colorB\" value=\"255\" />"
    	+"<input type=\"hidden\" name=\"maxH\" value=\"300\" />"
    	+"<input type=\"hidden\" name=\"filename\" value=\"filename\" />"
      	+"<p><input type=\"file\" name=\"filename\" onchange=\"ajaxUpload(this.form,'scripts/ajaxupload.php?filename=name&amp;maxSize=9999999999&amp;maxW=200&amp;fullPath=/jquery/uploads/&amp;relPath=../uploads/&amp;colorR=255&amp;colorG=255&amp;colorB=255&amp;maxH=300','upload_area','File Uploading Please Wait...&lt;br /&gt;&lt;img src=\'loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' /&gt;','&lt;img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /&gt; Error in Upload, check settings and path info in source code.'); return false;\" /></p>"
    	+"</form></div>").appendTo('#include_to');
    Code (markup):
    if it was like this it would work
    <form action="scripts/ajaxupload.php" method="post" name="sleeker" id="sleeker" enctype="multipart/form-data">
    	<input type="hidden" name="maxSize" value="9999999999" />
    	<input type="hidden" name="maxW" value="200" />
    	<input type="hidden" name="fullPath" value="/jquery/php_ajax_image_upload/uploads/" />
    	<input type="hidden" name="relPath" value="../uploads/" />
    	<input type="hidden" name="colorR" value="255" />
    	<input type="hidden" name="colorG" value="255" />
    	<input type="hidden" name="colorB" value="255" />
    	<input type="hidden" name="maxH" value="50" />
    	<input type="hidden" name="filename" value="filename" />
    	<p><input type="file" name="filename" onchange="ajaxUpload(this.form,'scripts/ajaxupload.php?filename=name&amp;maxSize=9999999999&amp;maxW=200&amp;fullPath=http://www.atwebresults.com/php_ajax_image_upload/uploads/&amp;relPath=../uploads/&amp;colorR=255&amp;colorG=255&amp;colorB=255&amp;maxH=300','upload_area2','File Uploading Please Wait...&lt;br /&gt;&lt;img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' /&gt;','&lt;img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /&gt; Error in Upload, check settings and path info in source code.'); return false;" /></p>
    						</form>
    Code (markup):
     
    ernest1a, Jun 10, 2009 IP
  4. korquee

    korquee Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, we are the same implemented the single quotations using a backslash (\). Double quotes will not need to be escaped.
     
    korquee, Jun 11, 2009 IP