$.get()总是执行不成功
$(document).ready(function(){
$("#new").click(function(){
var order1=document.getElementById("new1").value;
$.get("obj_search.php",{order:order1},function(response)
{
$("#show").html(response);
})
});
});
就是这一段,值总是传不过去,运行的时候根本就没有传值,我一直用这个方法写的都可以传,为什么这个总是运行不成功呢,我在$.get()之前加过alert(order1);可以运行就到了$.get()就不执行,
最近快被毕业设计弄疯,WEB开发懂得也不多,望大家赐教~~~~~~
------解决方案--------------------
alert(response);打印这个看看有结果集没
------解决方案--------------------
用jquery怎么不直接获取id
$("#new1").val();
顺便看一下你的ajax的URL是正确的么
------解决方案--------------------
$.get("obj_search.php",{“order”:order1},function(response)
------解决方案--------------------
用google浏览器查看http请求中都是啥,有没有返回你想要的东西,也可以直接访问obj_search.php?order=参数,看返回什么值。
------解决方案--------------------
用浏览器看下在点击的时候,是否有网络请求。
如果有的话,看下请求的地址是否错误,或者返回值是否异常
------解决方案--------------------
1、确认你的页面是从服务器上运行的
2、规范的写法是
$(document).ready(function(){<br /> $("#new").click(function(){<br /> var order1 = $("#new1").value;<br /> $.get("obj_search.php",{order:order1},function(response) {<br /> $("#show").html(response);<br /> })<br /> });<br />});
3、可在取得 order1 后 alert(order1) 观看一下
4、直接用浏览器运行 http://localhost/obj_search.php?order=1
------解决方案--------------------
那你的 obj_search.php 是怎么写的?

TheSecretTokeEpingAphp-PowerEdwebSiterUnningSmoothlyShyunderHeavyLoadInVolvOLVOLVOLDEVERSALKEYSTRATICES:1)emplactopCodeCachingWithOpcachingWithOpCacheToreCescriptexecution Time,2)使用atabasequercachingCachingCachingWithRedataBasEndataBaseLeSendataBaseLoad,3)

你應該關心DependencyInjection(DI),因為它能讓你的代碼更清晰、更易維護。 1)DI通過解耦類,使其更模塊化,2)提高了測試的便捷性和代碼的靈活性,3)使用DI容器可以管理複雜的依賴關係,但要注意性能影響和循環依賴問題,4)最佳實踐是依賴於抽象接口,實現鬆散耦合。

是的,優化papplicationispossibleandessential.1)empartcachingingcachingusedapcutorediucedsatabaseload.2)優化的atabaseswithexing,高效Quereteries,and ConconnectionPooling.3)EnhanceCodeWithBuilt-unctions,避免使用,避免使用ingglobalalairaiables,並避免使用

theKeyStrategiestosigantificallyBoostPhpaPplicationPerformenCeare:1)UseOpCodeCachingLikeLikeLikeLikeLikeCacheToreDuceExecutiontime,2)優化AtabaseInteractionswithPreparedStateTementStatementStatementAndProperIndexing,3)配置

aphpdepentioncontiveContainerIsatoolThatManagesClassDeptions,增強codemodocultion,可驗證性和Maintainability.itactsasaceCentralHubForeatingingIndections,因此reducingTightCightTightCoupOulplingIndeSingantInting。

選擇DependencyInjection(DI)用於大型應用,ServiceLocator適合小型項目或原型。 1)DI通過構造函數注入依賴,提高代碼的測試性和模塊化。 2)ServiceLocator通過中心註冊獲取服務,方便但可能導致代碼耦合度增加。

phpapplicationscanbeoptimizedForsPeedAndeffificeby:1)啟用cacheInphp.ini,2)使用preparedStatatementSwithPdoforDatabasequesies,3)3)替換loopswitharray_filtaray_filteraray_maparray_mapfordataprocrocessing,4)conformentnginxasaseproxy,5)

phpemailvalidation invoLvesthreesteps:1)格式化進行regulareXpressecthemailFormat; 2)dnsvalidationtoshethedomainhasavalidmxrecord; 3)


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

Dreamweaver CS6
視覺化網頁開發工具

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

WebStorm Mac版
好用的JavaScript開發工具