首页 > 其他分享 >$.get遇到null的异常

$.get遇到null的异常

时间:2023-07-28 10:56:59浏览次数:25  
标签:function 遇到 get api result null 异常

$.get不指定数据格式默认会智能解析成相应类型,如果后端返回null,会导致解析异常,最好加上异常捕捉

$.get(api,{},function(result){});
$.get(api,{},function(result){}, "json");

资料地址:https://www.w3cschool.cn/jquery/ajax-get.html

加上捕捉的完整写法

$.get(api, {}, function (result) {
    
}).fail(function (jqXHR, textStatus, errorThrown) 
    // 处理异常情况
});

标签:function,遇到,get,api,result,null,异常
From: https://www.cnblogs.com/BOSET/p/17586995.html

相关文章

  • ORA-00845:系统不支持MEMORY_TARGET
    错误信息【汉】ORA-00845:系统不支持MEMORY_TARGET【英】ORA-00845:MEMORY_TARGETnotsupportedonthissystem例在CentOS7操作系统上启动数据库时报错。版本Oracle【11.2.0.3.0】、【11.2.0.1.0】、【11.2.0.4.0】原因原因有两种可能,一是因为操作系统不支持参数【MEMORY_TARGET......
  • Android studio DerInputStream.getLength(): lengthTag=109, too big.Failed to
    AndroidStudio:解决DerInputStream.getLength():lengthTag=109,toobig.Failedto的问题简介在使用AndroidStudio开发Android应用程序时,你可能会遇到DerInputStream.getLength():lengthTag=109,toobig.Failedto的错误。该错误通常发生在尝试使用包含较大数据的......
  • String mobleCode = redisTemplate.opsForValue().get(phone);
    使用RedisTemplate获取手机验证码在现代的应用程序中,手机验证码被广泛用于用户身份验证和安全验证。使用手机验证码可以确保用户提供的手机号是有效的,并且可以防止恶意行为。在本文中,我们将介绍如何使用SpringDataRedis中的RedisTemplate来获取手机验证码。RedisTemplate简介R......
  • VS 还原 NuGet 程序包时出错: 无法加载源 https://dotnet.myget.org/F/aspnetcore-dev
    错误还原NuGet程序包时出错:无法加载源https://dotnet.myget.org/F/aspnetcore-dev/api/v3解决方法在新源中添加地址:https://www.nuget.org/api/v2/......
  • appuim 做自动化测试的时候遇到的一些报错 附解决方法
    1、selenium.common.exceptions.InvalidElementStateException:Message:UnabletoperformW3Cactions.Checkthelogcatoutputforpossibleerrorreportsandmakesureyourinputactionschainisvalid.2、http.client.RemoteDisconnected:Remoteendclosedconn......
  • QueryWrapper 查询数据库字段不为null和空字符串
    https://wenku.csdn.net/answer/50db66695ced42d380b982b85cd5fca7......
  • idhttp get 与 post 方法
    idHttp两种传输数据的方法,即get和post总结*服务端用c#模拟WebApiusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Net;usingSystem.Net.Http;usingSystem.Web.Http;namespacewebapitest1.Controllers{publicclassProduc......
  • poj 2886 Who Gets the Most Candies? (线段树单点更新应用)
                           poj2886WhoGetstheMostCandies?DescriptionNchildrenaresittinginacircletoplayagame.Thechildrenarenumberedfrom1toNinclockwiseorder.Eachofthemhasacardwithanon-zerointegeronit......
  • VS2022 CUDA 遇到的一些问题记录
    头文件 #include"device_launch_parameters.h" cudaDeviceSynchronize()需要使用#include"cuda_runtime.h" dim3需要使用。 在windows下使用linux库来实现对内核函数计时参考资料:【CUDA基础】2.3组织并行线程|谭升的博客(face2ai.com)实现方式:(38条消......
  • GET chrome-extension://invalid/ net::ERR_FAILED是什么错误
    GETchrome-extension://invalid/net::ERR_FAILED是什么错误错误信息"GETchrome-extension://invalid/net::ERR_FAILED"通常表示在Chrome浏览器中发生了一个资源加载失败的问题。该错误信息表明浏览器尝试获取一个Chrome扩展(chrome-extension)中的资源,但该资源的URL地址是无效......