日期:2014-05-16  浏览次数:20326 次

Jquery里面调用substr函数的时候报错
function submit(obj, url) {
    if ($(obj).is_validate()) {
        var post = $(obj).serialize();
        $.ajax({
            type: "POST",
            url: $(obj).attr("action"),
            cache: false,
            data: post,
            success: function (data) {
                alert(data);
                if (data.substr(0, 1) == '{') {
                    data = jQuery.parseJSON(data);
                    if (data.state == 1) {
                        $.dialog({
                            message: data.message,
                            timeout: data.timeout || 3,
                            type: "success",
                            close_handler: function () {
                                if (url) {
                                    location.href = url
                                } else {
                                    window.location.reload(true);
                                }
                            }
                        });
           &