前端获取店铺类别和区域失败

来源:4-11 店铺类别区域信息的获取

C哩C哩1

2020-03-04

/**
*shopoperation.js文件
*/
$(function(){
var initUrl=‘shop/shopadmin/getshopinitinfo’;
var registerShopUrl=‘shop/shopadmin/registershop’;
//alert(initUrl);
getShopInitInfo();
function getShopInitInfo(){
$.getJSON(initUrl,function(data){
if(data.success){
var tempHtml=’’;
var tempAreaHtml=’’;
data.shopCategoryList.map(function(item,index){
tempHtml +=’’+item.shopCategoryName+’’;
});
data.areaList.map(function(item,index){
tempAreaHtml +=’’
+item.areaName+’’;
});
$(’#shop-category’).html(tempHtml);
$(’#area’).html(tempAreaHtml);
}
});
KaTeX parse error: Expected 'EOF', got '#' at position 3: ('#̲submit').click(…(’#shop-name’).val();
shop.ahopAddr=KaTeX parse error: Expected 'EOF', got '#' at position 3: ('#̲shop-addr').val…(‘shop-phone’).val();
shop.shopDesc=KaTeX parse error: Expected '}', got 'EOF' at end of input: …shopCategoryId:(’#shop-category’).find(‘option’).not(function(){
return !this.selected;
}).data(‘id’)
};
shop.area={
areaId:KaTeX parse error: Expected 'EOF', got '#' at position 3: ('#̲area').find('op…(’#shop-img’)[0].file[0];
var formDate=new FormData();
formDta.append(‘shopImg’,shopImg);
formData.append(‘shopStr’,JSON.stringify(shop));
$.ajax({
url:registerShopUrl,
type:‘POST’,
data:formData,
contentType:false,
proceesData:false,
cache:false,
success:function(data){
if(data.success){
$.toast(‘提交成功!’)
}else{
$.toast(‘提交失败!’+data.errMsg);
}
}
});
});
}
})
报错日志文件:
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/8.5.42
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Jun 4 2019 20:29:04 UTC
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 8.5.42.0
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 10.0
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: x86
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: D:\softinstall\jdk\jre
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_191-b12
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: D:\Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: D:\Projects\apache-tomcat-8.5.42
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\Projects\apache-tomcat-8.5.42
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=D:\Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\Projects\apache-tomcat-8.5.42\endorsed
三月 04, 2020 9:14:44 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
三月 04, 2020 9:14:44 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\softinstall\jdk\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/softinstall/jdk/bin/…/jre/bin/client;D:/softinstall/jdk/bin/…/jre/bin;D:/softinstall/jdk/bin/…/jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;D:\softinstall\jdk\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\softinstall\SSH;D:\softinstall\Microsoft VS Code\bin;;D:\softinstall\python\PyCharm Community Edition 2019.3.3\bin;;D:\softinstall\eclipse-jee-oxygen-3a-win32\eclipse;;.]
三月 04, 2020 9:14:44 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler [“http-nio-8080”]
三月 04, 2020 9:14:45 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
三月 04, 2020 9:14:45 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler [“ajp-nio-8009”]
三月 04, 2020 9:14:45 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
三月 04, 2020 9:14:45 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1641 ms
三月 04, 2020 9:14:45 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Catalina]
三月 04, 2020 9:14:45 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.5.42
三月 04, 2020 9:14:51 上午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
三月 04, 2020 9:14:59 上午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
三月 04, 2020 9:14:59 上午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
三月 04, 2020 9:14:59 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [“http-nio-8080”]
三月 04, 2020 9:14:59 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [“ajp-nio-8009”]
三月 04, 2020 9:14:59 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 14242 ms
三月 04, 2020 9:16:03 上午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'spring-dispatcher’
三月 04, 2020 9:16:04 上午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet ‘spring-dispatcher’: initialization started
三月 04, 2020 9:16:04 上午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
信息: Refreshing WebApplicationContext for namespace ‘spring-dispatcher-servlet’: startup date [Wed Mar 04 09:16:04 CST 2020]; root of context hierarchy
三月 04, 2020 9:16:04 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [D:\Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\shop\WEB-INF\classes\spring\spring-dao.xml]
三月 04, 2020 9:16:04 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [D:\Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\shop\WEB-INF\classes\spring\spring-service.xml]
三月 04, 2020 9:16:04 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from file [D:\Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\shop\WEB-INF\classes\spring\spring-web.xml]
三月 04, 2020 9:16:05 上午 com.mchange.v2.log.MLog
信息: MLog clients using java 1.4+ standard logging.
三月 04, 2020 9:16:05 上午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
三月 04, 2020 9:16:06 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
信息: Mapped “{[/shopadmin/shopoperation],methods=[GET]}” onto public java.lang.String com.cl.shop.web.shopadmin.ShopAdminController.shopOperation()
三月 04, 2020 9:16:06 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
信息: Mapped “{[/shopadmin/registershop],methods=[POST]}” onto private java.util.Map<java.lang.String, java.lang.Object> com.cl.shop.web.shopadmin.ShopManagementController.registerShop(javax.servlet.http.HttpServletRequest)
三月 04, 2020 9:16:06 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
信息: Mapped “{[/shopadmin/getshopinitinfo],methods=[GET]}” onto private java.util.Map<java.lang.String, java.lang.Object> com.cl.shop.web.shopadmin.ShopManagementController.getShopInitinfo()
三月 04, 2020 9:16:06 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
信息: Mapped “{[/superadmin/listarea],methods=[GET]}” onto private java.util.Map<java.lang.String, java.lang.Object> com.cl.shop.web.superadmin.AreaController.listArea()
三月 04, 2020 9:16:07 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace ‘spring-dispatcher-servlet’: startup date [Wed Mar 04 09:16:04 CST 2020]; root of context hierarchy
三月 04, 2020 9:16:07 上午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
信息: Looking for @ControllerAdvice: WebApplicationContext for namespace ‘spring-dispatcher-servlet’: startup date [Wed Mar 04 09:16:04 CST 2020]; root of context hierarchy
三月 04, 2020 9:16:07 上午 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
信息: Mapped URL path [/resources/] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0’
三月 04, 2020 9:16:07 上午 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
信息: Mapped URL path [/
] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0’
三月 04, 2020 9:16:07 上午 org.springframework.web.servlet.DispatcherServlet initServletBean
信息: FrameworkServlet ‘spring-dispatcher’: initialization completed in 3408 ms
三月 04, 2020 9:16:07 上午 org.apache.tomcat.util.http.parser.Cookie logInvalidHeader
信息: A cookie header was received [1583284568; Hm_lpvt_ba76f8230db5f616edc89ce066670710=1583284568] that contained an invalid cookie. That cookie will be ignored.Note: further occurrences of this error will be logged at DEBUG level.
图片描述

写回答

3回答

慕田峪944480

2020-03-04

按照我的理解 404就是 找不到后端。你可以从 console 切换到 network 然后刷新,看看到底文件找不到的原因,是url哪里写错了。

2
1
翔仔
感谢同学的给力支持
2020-03-04
共1条回复

翔仔

2020-03-04

同学好,同样的问题,请勿重复提问哈,在一个问题里解决就好,不然大家回来看问题的时候发现断了,你的就是shop多加了

1
7
翔仔
回复
慕勒4553688
啊?同学说的啥意思,请提供一下上下文哈:)
2020-04-14
共7条回复

慕田峪944480

2020-03-04

我看到你有好多的 KaTeX parse error。你检查一下js格式比较好。

$(function () {
    let init_url = '/o2o/shopadmin/getshopinitinfo';
    let register_shop_url = '/o2o/shopadmin/registershop';
    getShopInitInfo();

    function getShopInitInfo() {
        $.getJSON(init_url, function (data) {
            if (data.success) {
                let temp_html = '';
                let temp_area_html = '';
                data.shopCategoryList.map(function (item, index) {
                    temp_html += '<option data_id="' + item.shopCategoryId + '">' + item.shopCategoryName + '</option>'
                });
                data.areaList.map(function (item, index) {
                    temp_area_html += '<option data-id="' + item.areaId + '">' + item.areaName + '</option>'
                });
                $('#shop-category').html(temp_html);
                $('#shop-area').html(temp_area_html)
            }
        });

        $('#submit').click(function () {
            let shop = {};
            shop.shopName = $('#shop-name').val();
            shop.shopAddr = $('#shop-addr').val();
            shop.phone = $('#shop-phone').val();
            shop.shopDesc = $('#shop-desc').val();
            shop.shopCategory = {
                shopCategoryId: $('#shop-category').find('option').not(function () {
                    return !this.selected;
                }).data('id')
            };
            shop.area = {
                areaId: $('#shop-area').find('option').not(function () {
                    return !this.selected;
                }).data('id')
            };
            let shopImg = $('#shop-img')[0].files[0];
            let formData = new FormData();
            formData.append('shopImg', shopImg);
            console.log(formData.get("shopImg"));
            formData.append('shopStr', JSON.stringify(shop));
            console.log(formData.get("shopStr"));
            let verifyCodeActual = $('#kaptcha').val();
            if (!verifyCodeActual) {
                alert('请输入验证码!');
                return
            }
            formData.append('verifyCodeActual', verifyCodeActual);
            $.ajax({
                url: register_shop_url,
                type: 'POST',
                data: formData,
                contentType: false,
                processData: false,
                cache: false,
                success: function (data) {
                    if (data.success) {
                        alert("提交成功");
                    } else {
                        alert("提交失败" + data.errMsg);
                    }
                    $("#captcha_img").click();
                }
            })

        })
    }
});


0
3
C哩C哩1
回复
慕田峪944480
加上了 也不行
2020-03-04
共3条回复

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程