警告对话框不适用于按钮单击功能jquery

时间:2017-07-14 14:27:29

标签: javascript jquery

我正在尝试在一个按钮单击中添加两个动作,一个手柄形式发布另一个以显示警报,一个用于发布工作但是一个显示警报不会。当我尝试在此按钮内单击另一个操作时不起作用

  $('plot_marker').click(function () {
    $.post('/searched/', $('mapform').serialize(), function (data) {

        },
        'json' // I expect a JSON response
    );
    alert("Hello!");

});

2 个答案:

答案 0 :(得分:2)

除非您使用的是Web Components或其他框架,否则您几乎肯定是find * -maxdepth 2 -name config.xml -exec /path/to/maven2freestyle.py {} \;#!/usr/bin/env python2 import copy import sys from lxml import etree from lxml.etree import fromstring, tostring from StringIO import StringIO def parseXML(xmlFile): print(xmlFile) f = open(xmlFile) xml = f.read() f.close() e = etree.parse(xmlFile) root = e.getroot() if root.tag != 'maven2-moduleset': #print("WARNING: Skipping non Maven Project") return #change project type root.tag = "project" if 'plugin' in root.attrib: del root.attrib["plugin"] #get maven data rootModule = root.find('./rootModule') rootPOM = root.find('./rootPOM') goals = root.find('./goals') mavenName = root.find('./mavenName') mavenOpts = root.find('./mavenOpts') # merge prebuilders into builders prebuilders = root.findall("./prebuilders/*") builders = etree.Element("builders") root.insert(99, builders) if len(prebuilders) > 0: builders.append(copy.deepcopy(prebuilders[0])) #create maven builder maven = etree.Element("hudson.tasks.Maven") if not goals is None: etree.SubElement(maven, "targets").text = goals.text if not mavenName is None: etree.SubElement(maven, "mavenName").text = mavenName.text if not rootPOM is None: etree.SubElement(maven, "pom").text = rootPOM.text if not mavenOpts is None: etree.SubElement(maven, "javaOpts").text = mavenOpts.text builders.append(maven) #cleanup prebuilder = root.findall("./prebuilders") if len(prebuilder) > 0: root.remove(prebuilder[0]) if not rootModule is None: root.remove(rootModule) if not rootPOM is None: root.remove(rootPOM) if not goals is None: root.remove(goals) if not mavenName is None: root.remove(mavenName) if not mavenOpts is None: root.remove(mavenOpts) e.write(sys.argv[1], xml_declaration=True, pretty_print=True, encoding='utf-8', method="xml") if __name__ == "__main__": parseXML(sys.argv[1])

在您的示例代码中,您使用了is a tag selector这是一个有效的查询选择器,用于按名称选择标记,但这可能不是您原来的意图。

答案 1 :(得分:0)

在下面的代码中,除非' plot_marker'是一个标签名称,它应该是' #plot_marker'或者' .plot_marker'取决于它是一个id还是一个类。

$('plot_marker').click(function () {
    $.post('/searched/', $('mapform').serialize(), function (data) {

        },
        'json' // I expect a JSON response
    );
    alert("Hello!");

});