- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
它是一个 XMLHttpRequest 来获取一个 json 表单。我在 3 个不同的主机上测试了它:
我已经一次又一次地比较标题。然后我一整天都在谷歌上搜索并阅读了很多文章..但仍然可以找出原因..这里对我来说很少有可疑之处:
我失败的完整 header :
Request URL:http://example.com/oxwall/base/ajax-loader/component/?cmpClass=PHOTO_CMP_AjaxUpload&r=0.41719201277010143
Request Method:POST
Status Code:406 Not Acceptable
Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:38
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:.................
Host:example.com
Origin:http://example.com
Referer:http://example.com/oxwall/
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36
X-Requested-With:XMLHttpRequest
Query String Parametersview sourceview decoded
cmpClass:PHOTO_CMP_AjaxUpload
r:0.41719201277010143
Form Dataview sourceview decoded
params:%5Bnull%2Cnull%2Cnull%2Cnull%5D
Response Headersview source
Connection:Keep-Alive
Content-Length:404
Content-Type:text/html; charset=iso-8859-1
Date:Sat, 09 Aug 2014 09:20:32 GMT
Keep-Alive:timeout=5
Server:Apache mod_fcgid/2.3.10-dev
Json 中的成功响应:
{"content":"<div class=\"ow_photo_upload_wrap\" id=\"add-new-photo-container\">\n <div class=\"ow_hidden\">\n <iframe name=\"iframe_upload\" id=\"iframe_upload\" src=\"about:blank\"><\/iframe>\n <form id=\"upload-form\" target=\"iframe_upload\" enctype=\"multipart\/form-data\" method=\"post\" action=\"http:\/\/conyeu.me\/photo\/ajax-upload\">\n <input type=\"file\" name=\"file\" accept=\"image\/jpeg,image\/png,image\/gif\" multiple \/>\n <\/form>\n <div id=\"slot-prototype\" class=\"ow_photo_preview_edit\">\n <input type=\"hidden\" name=\"slot\" \/>\n <input type=\"hidden\" name=\"rotate\" \/>\n <div class=\"ow_photo_preview_action\">\n <div class=\"ow_photo_preview_image ow_photo_preview_loading\">\n <div class=\"ow_photo_preview_image_filter\"><\/div>\n <\/div>\n <div class=\"ow_photo_preview_x\"><\/div>\n <div class=\"ow_photo_preview_rotate\"><\/div>\n <\/div>\n <div class=\"ow_photo_upload_description\" style=\"min-height: 58px\">\n <textarea class=\"ow_hidden invitation\"><\/textarea>\n <\/div>\n <\/div>\n <\/div>\n\n <div class=\"ow_photo_dragndrop\">\n <div id=\"drop-area\" ondragover=\"return false;\"><\/div>\n <span id=\"drop-area-label\">photo+dnd_support<\/span>\n <\/div>\n\n <form id=\"form_79795474\" method=\"post\" action=\"http:\/\/conyeu.me\/photo\/ajax-upload-submit\" name=\"ajax-upload\">\n<input name=\"form_name\" id=\"input_82938081\" type=\"hidden\" value=\"ajax-upload\" \/>\n\n <div id=\"slot-area\" class=\"ow_photo_preview_block_wrap clearfix\"><\/div>\n\n <div id=\"photo-album-form\" class=\"ow_photo_upload_bottom clearfix\">\n <div id=\"photo-album-list\" class=\"ow_left\">\n <div class=\"ow_suggest_field ow_smallmargin\">\n <input name=\"album\" id=\"input_48713404\" type=\"text\" class=\"ow_dropdown_btn ow_inputready ow_cursor_pointer\" autocomplete=\"off\" readonly=\"readonly\" value=\"Ch\u1ecdn album c\u00f3 s\u1eb5n ho\u1eb7c t\u1ea1o album m\u1edbi\" \/>\n <div class=\"ow_dropdown_list_wrap\">\n <ul class=\"ow_dropdown_list\">\n <li>T\u1ea1o Album m\u1edbi<span class=\"ow_add_item\"><\/span><\/li>\n <\/ul>\n <\/div>\n <div class=\"ow_dropdown_arrow_down upload_photo_spinner\"><\/div>\n <span id=\"input_53937208_error\" style=\"display:none;\" class=\"error\"><\/span>\n <\/div>\n <div class=\"new-album\" style=\"display: none\">\n <input name=\"album-name\" id=\"input_53937208\" type=\"text\" class=\"ow_smallmargin invitation\" value=\"T\u00ean album\" \/>\n <textarea name=\"description\" id=\"input_87690768\" class=\"invitation\">Ch\u1ecdn album hi\u1ec7n c\u00f3 ho\u1eb7c t\u1ea1o m\u1ed9t h\u00ecnh m\u1edbi<\/textarea>\n <\/div>\n <\/div>\n <div class=\"ow_photo_upload_submit ow_right\">\n <span class=\"ow_button\">\n <span class=\" ow_ic_submit ow_positive\">\n <span class=\"ow_button\"><span class=\" ow_ic_submit ow_positive\"><input type=\"submit\" value=\"Submit\" id=\"input_95606675\" class=\"ow_ic_submit ow_positive\"name=\"submit\" value=\"Submit\" \/><\/span><\/span>\n <\/span>\n <\/span>\n <\/div>\n <\/div>\n \n<\/form>\n<\/div>","beforeIncludes":";window.ajaxPhotoUploadParams = {};\n Object.defineProperties(ajaxPhotoUploadParams, {\n actionUrl: {\n value: \"http:\\\/\\\/conyeu.me\\\/photo\\\/ajax-upload\",\n writable: false,\n enumerable: true\n },\n maxFileSize: {\n value: 8388608,\n writable: false,\n enumerable: true\n },\n deleteAction: {\n value: \"http:\\\/\\\/conyeu.me\\\/photo\\\/ajax-upload-delete\",\n writable: false,\n enumerable: true\n }\n });\n","scriptFiles":["http:\/\/conyeu.me\/ow_static\/plugins\/photo\/js\/jQueryRotate.min.js","http:\/\/conyeu.me\/ow_static\/plugins\/photo\/js\/codemirror.min.js","http:\/\/conyeu.me\/ow_static\/plugins\/photo\/js\/upload.js"],"onloadScript":"OW.registerLanguageKey('photo', 'not_all_photos_uploaded', \"Some photos were not uploaded because of excessive size or wrong format\");OW.registerLanguageKey('photo', 'size_limit', \"K\\u00edch t\\u1eadp tin h\\u00ecnh \\u1ea3nh kh\\u00f4ng th\\u1ec3 l\\u1edbn h\\u01a1n <b>{$size}<\\\/b>Mb\");OW.registerLanguageKey('photo', 'type_error', \"T\\u1ec7p kh\\u00f4ng h\\u1ee3p l\\u1ec7: {$name}\");OW.registerLanguageKey('photo', 'dnd_support', \"photo+dnd_support\");OW.registerLanguageKey('photo', 'dnd_not_support', \"photo+dnd_not_support\");OW.registerLanguageKey('photo', 'drop_here', \"photo+drop_here\");OW.registerLanguageKey('photo', 'please_wait', \"Xin h\\u00e3y \\u0111\\u1ee3i trong khi c\\u00e1c \\u1ea3nh tr\\u01b0\\u1edbc \\u0111ang t\\u1ea3i l\\u00ean\");OW.registerLanguageKey('photo', 'create_album', \"T\\u1ea1o Album m\\u1edbi\");OW.registerLanguageKey('photo', 'album_name', \"T\\u00ean album\");OW.registerLanguageKey('photo', 'album_desc', \"Ch\\u1ecdn album hi\\u1ec7n c\\u00f3 ho\\u1eb7c t\\u1ea1o m\\u1ed9t h\\u00ecnh m\\u1edbi\");OW.registerLanguageKey('photo', 'describe_photo', \"Describe this photo\");OW.registerLanguageKey('photo', 'photo_upload_error', \"Photo upload error\"); var form = new OwForm({\"id\":\"form_79795474\",\"name\":\"ajax-upload\",\"reset\":false,\"ajax\":true,\"ajaxDataType\":\"json\",\"validateErrorMessage\":\"H\\u00e3y \\u0111i\\u1ec1n v\\u00e0o m\\u1eabu \\u0111\\u00fang c\\u00e1ch\"});window.owForms[form.name] = form;\n\t\t\t\nvar formElement = new OwFormElement(\"input_82938081\", \"form_name\");\nform.addElement(formElement);\nvar formElement = new OwTextField(\"input_53937208\", \"album-name\", false);formElement.addValidator({\n \tvalidate : function( value ){\n if( $.isArray(value) ){ if(value.length == 0 ) throw \"B\\u1eaft bu\\u1ed9c\"; return;}\n else if( !value || $.trim(value).length == 0 ){ throw \"B\\u1eaft bu\\u1ed9c\"; }\n },\n \tgetErrorMessage : function(){ return \"B\\u1eaft bu\\u1ed9c\" }\n });formElement.addValidator({\n validate : function( value )\n {\n if ( null && null.trim().toLowerCase() == \"B\\u1ea3ng tin \\u1ea3nh\".toString().trim().toLowerCase() )\n {\n return true;\n }\n \n if ( value.toString().trim().toLowerCase() == \"B\\u1ea3ng tin \\u1ea3nh\".toString().trim().toLowerCase() )\n {\n throw \"B\u1ea1n kh\u00f4ng th\u1ec3 t\u1ea1o ho\u1eb7c t\u1ea3i \u1ea3nh l\u00ean v\u1edbi t\u00ean n\u00e0y\";\n }\n }\n });\nform.addElement(formElement);\nvar formElement = new OwTextArea(\"input_87690768\", \"description\", false);\nform.addElement(formElement);\nvar formElement = new OwTextField(\"input_48713404\", \"album\", false);formElement.addValidator({\n \tvalidate : function( value ){\n if( $.isArray(value) ){ if(value.length == 0 ) throw \"B\\u1eaft bu\\u1ed9c\"; return;}\n else if( !value || $.trim(value).length == 0 ){ throw \"B\\u1eaft bu\\u1ed9c\"; }\n },\n \tgetErrorMessage : function(){ return \"B\\u1eaft bu\\u1ed9c\" }\n });\nform.addElement(formElement);\n\n\n\t\t\tif ( form.form ) \n\t\t\t{\n \t\t\t$(form.form).bind( 'submit', {form:form},\n \t\t\t\t\tfunction(e){\n \t\t\t\t\t\treturn e.data.form.submitForm();\n \t\t\t\t\t}\n \t\t\t);\n }\n \n OW.trigger('base.onFormReady.' + form.name, [], form);\n OW.trigger('base.onFormReady', [form]);\n\t\tform.bind('success', function( data )\n {\n if ( data )\n {\n if ( !data.result )\n {\n if ( data.msg )\n {\n OW.error(data.msg);\n }\n else\n {\n OW.getLanguageText(\"photo\", \"photo_upload_error\");\n }\n }\n else\n {\n var url = null;\n \n if ( url )\n {\n window.location.href = url;\n }\n else if ( data.url )\n {\n window.location.href = data.url;\n }\n }\n }\n else\n {\n OW.error(\"Server error\");\n }\n });;window.ajaxPhotoUploader.init();","styleSheets":["http:\/\/example.com\/ow_static\/plugins\/photo\/css\/photo_upload.css"]}
请给我一些线索,我需要调查什么。
最佳答案
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html (查找406)
在您的回复中:
Content-Type:text/html; charset=iso-8859-1
在您的请求中:
Accept:application/json, text/javascript, */*; q=0.01
我猜你必须设置接受。如果您不使用 jQuery(未标记),则 here是如何使用 vanilla JS 实现的:
xmlhttp.setRequestHeader("Accept"
, "text/html");
您应该尝试在浏览器中打开 url,因为您需要向它发送值以查看它是否正常工作,您可以创建一个 html 文件,格式为 method=post action=your godaddy site。
关于javascript - 为什么这个 XMLHttpRequest 导致 http 406,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25217469/
我正在尝试使用 Spark 从 Cassandra 读取数据。 DataFrame rdf = sqlContext.read().option("keyspace", "readypulse
这是代码: void i_log_ (int error, const char * file, int line, const char * fmt, ...) { /* Get erro
我必须调试一个严重依赖 Gtk 的程序。问题是由于某些原因,在使用 GtkWindow 对象时开始出现许多运行时警告。问题是,即使 Gtk 提示严重错误,它也不会因这些错误而中止。我没有代码库的更改历
我正在尝试从已有效编译和链接的程序中检索二进制文件。我已经通过 GL_PROGRAM_BINARY_LENGTH 收到了它的长度。该文档说有两个实例可能会发生 GL_INVALID_OPERATION
我有一个托管在 Azure 环境中的服务。我正在使用控制台应用程序使用该服务。这样做时,我得到了异常: "The requested service, 'http://xxxx-d.yyyy.be/S
我有以下代码,它被 SEGV 信号杀死。使用调试器表明它被 main() 中的第一个 sem_init() 杀死。如果我注释掉第一个 sem_init() ,第二个会导致同样的问题。我试图弄清楚是什么
目前我正在编写一个应用程序(目标 iOS 6,启用 ARC),它使用 JSON 进行数据传输,使用核心数据进行持久存储。 JSON 数据由 PHP 脚本通过 json_encode 从 MySQL 数
我对 Xamarin.Forms 还是很陌生。我在出现的主页上有一个非常简单的功能 async public Task BaseAppearing() { if (UserID
这是我的代码的简化版本。 public class MainActivity extends ActionBarActivity { private ArrayList entry = new Arr
我想弄明白为什么我的两个 Java 库很难很好地协同工作。这是场景: 库 1 有一个类 A,其构造函数如下: public A(Object obj) { /* boilerplate */ } 在以
如果网站不需要身份验证,我的代码可以正常工作,如果需要,则在打印“已创建凭据”后会立即出现 EXC_BAD_ACCESS 错误。我不会发布任何内容,并且此代码是直接从文档中复制的 - 知道出了什么问题
我在使用 NSArray 填充 UITableView 时遇到问题。我确信我正在做一些愚蠢的事情,但我无法弄清楚。当我尝试进行简单的计数时,我得到了 EXC_BAD_ACCESS,我知道这是因为我试图
我在 UITableViewCell 上有一个 UITextField,在另一个单元格上有一个按钮。 我单击 UITextField(出现键盘)。 UITextField 调用了以下方法: - (BO
我有一个应用程序出现间歇性崩溃。崩溃日志显示了一个堆栈跟踪,这对我来说很难破译,因此希望其他人看到了这一点并能为我指出正确的方向。 基本上,应用程序在启动时执行反向地理编码请求,以在标签中显示用户的位
我开发了一个 CGImage,当程序使用以下命令将其显示在屏幕上时它工作正常: [output_view.layer performSelectorOnMainThread:@selector(set
我正在使用新的 EncryptedSharedPreferences以谷歌推荐的方式上课: private fun securePrefs(context: Context): SharedPrefe
我有一个中继器,里面有一些控件,其中一个是文本框。我正在尝试使用 jquery 获取文本框,我的代码如下所示: $("#").click(function (event) {}); 但我总是得到 nu
在以下场景中观察到 TTS 初始化错误,太随机了。 已安装 TTS 引擎,存在语音集,并且可以从辅助功能选项中播放示例 tts。 TTS 初始化在之前初始化和播放的同一设备上随机失败。 在不同的设备(
maven pom.xml org.openjdk.jol jol-core 0.10 Java 类: public class MyObjectData { pr
在不担心冲突的情况下,可以使用 MD5 作为哈希值,字符串长度最多为多少? 这可能是通过为特定字符集中的每个可能的字符串生成 MD5 哈希来计算的,长度不断增加,直到哈希第二次出现(冲突)。没有冲突的
我是一名优秀的程序员,十分优秀!