我正在尝试通过 ajax-jquery 显示图像。
这是我的 html 的一部分:
<div id="searchFormResult1"></div>
<form action="#" method="post" id="searchForm" onSubmit="return false;">
<input type="text" maxlength="10" id="searchid" name="searchid" class="searchstu" />
<input type="submit" value="0" id="searchsubb" class="hidd searchsub" />
<a href="#" id="link-2" onClick="sear(); return false;"></a>
</form>
div标签是返回php的地方。
我的 jquery 是这样的,我将 jquery 放在 html 页面中:
$("#searchsubb").click(function(){
$.post("parts/search.php", {searchid:$("#searchid").val()}, function(data){
$("#searchFormResult1").html(data).slideDown();
});
});
我还有一个返回图像 html 标记的 php 页面:
像这样的东西:
print "<img src='' /> and other thing";
但我的返回值没有收到。
我的浏览器没有出现任何错误,我相信问题不在于我的 php.ini 文件。
我有时会在 chrome 中收到此错误。
Error in event handler for 'undefined': INDEX_SIZE_ERR: DOM Exception 1 Error: Index or size was negative, or greater than the allowed value.
at J (chrome-extension://mgijmajocgfcbeboacabfgobmjgjcoja/content_js_min.js:14:142)
at null.<anonymous> (chrome-extension://mgijmajocgfcbeboacabfgobmjgjcoja/content_js_min.js:17:184)
at chrome-extension://mgijmajocgfcbeboacabfgobmjgjcoja/content_js_min.js:1:182
at miscellaneous_bindings:286:9
at chrome.Event.dispatchToListener (event_bindings:387:21)
at chrome.Event.dispatch_ (event_bindings:373:27)
at chrome.Event.dispatch (event_bindings:393:17)
at Object.chromeHidden.Port.dispatchOnMessage (miscellaneous_bindings:253:22)