用ajax从第二个web服务url重新加载web页面

Reloading a web page with ajax from a second web service url

本文关键字:web 加载 页面 新加载 url ajax 第二个 服务      更新时间:2023-09-26

我有一个从具有特定url的web服务获取数据的页面,我正在做一些特征(一个复选框多个选择),我想让我的相同的页面重新加载,并从第二个web服务从第二个url回收它的数据。

这是我第一次恢复数据的js块:

var find_freelance = {
        page: [$('[data-page="mypage"]')],
        route: {
              getdata: back + 'api/webservice1',
        },
        block: {
            resume: $(""),
        },
        init: function () {
            console.log(find_freelance.page);
            for (var i in find_freelance.page) {
                if (find_freelance.page[i].length) {
                    this.getData();
                }
            }
        },
getData: function () {
            $.ajax({
                method: 'GET',
                url: find_freelance.route.getfreelance,
                dataType: 'json',
                success: function (data) {
                    matchDataHtml(data);
                    matchDataHtmlFor(data);
                    matchDataHtmIf(data);
                    customTraitement()
                },
                error: function (data) {
                    console.log(data);
                }
            });
        },

现在我想在自定义动作后重新加载页面(customTraitement())从第二个响应的web服务。

" api/webservice2

我该怎么做,有什么建议吗??

添加到ajax函数"return false;"的最后一句话

getData: function () {

        $.ajax({
            method: 'GET',
            url: find_freelance.route.getfreelance,
            dataType: 'json',
            success: function (data) {
                matchDataHtml(data);
                matchDataHtmlFor(data);
                matchDataHtmIf(data);
                customTraitement()
            },
            error: function (data) {
                console.log(data);
            }
        return false;
        });
    },