weixin_33695450 2017-03-31 16:17 采纳率: 0%
浏览 31

扩展jQuery AJAX函数

I'm using the HTML5 Neptune framework, to create SAPUI5 applications. At runtime my code gets inserted into the index.html file, mixed in between the code generated from the framework.

In a part of the code below the code area I control, the framework creates an ajax function I would like to modify. I would like to inject code into the jQuery AJAX success callback function. I this possible?

<html>
<head></head>
<body>
  <form>
    <div id="MobileContent"></div>
    <input type="hidden" name="applid" value="XXX">
  </form>
  <script>
    var JSONH, jsonh = JSONH = function(n, r) {
      //Framework code
    }(Array, JSON);

    // framework code
    ...
    // my code
    ...
    // framework code
    ...
    function getOnlineXxx(value) {
      $.ajax({
        type: "POST",
        contentType: "application/json",
        url: "neptune_ajax?ajax_id=xxx=" + value + "",
        dataType: "json",
        data: encodeURIComponent(modelXxx.getJSON(),
        success: function(data) {
          // framework code
          // code I would like to execute!!!
        }
      });
    }    
    ....    
    jQuery(function() {
      jQuery("form").submit(function(event) {
        event.preventDefault();
        return false;
    });
  });
</script>
</body>
</html>
  • 写回答

0条回答 默认 最新

    报告相同问题?