javascript - jQuery Ajax post with both file and data?? -
these lines below form data need post using ajax request, , json response.
<textarea type='text' id="newstatusbox">your status here...</textarea> link:<input type="text" id="newstatuslink"/> video:<input type="text" id="newstatusvideo"/> image : <input type="file" id="newstatusimage" size="20" /> <input type='button' value="post" id="status-post-button" onclick='poststatus()'/>
when use $.ajax of jquery in poststatus() post data, i'm not getting image file in page.
is there other solution achieve want?
you cannot upload files via ajax unless people use recent browser.
anyway, can use jquery form plugin. if have file upload field in form fallback hidden iframe instead of xhr. however, in case response must sent text/html
, wrapped in <textarea>
since cannot send proper json content type cause browsers show download dialog.
you have @ http://www.plupload.com/ wraps tons of upload technologies , uses best 1 available each user.
Comments
Post a Comment