Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery rossDomain参数。你能告诉我它的基本情况或任何链接吗?在MVC方面,您的意思是这样的吗?您需要一个映射到某个URL的控制器方法,该URL将返回submitAndRefreshEmails方法。然后您只需使用映射的URL来调用它。感谢您的响应…我没有_Jquery_Ajax_Json_Spring Mvc - Fatal编程技术网

Jquery rossDomain参数。你能告诉我它的基本情况或任何链接吗?在MVC方面,您的意思是这样的吗?您需要一个映射到某个URL的控制器方法,该URL将返回submitAndRefreshEmails方法。然后您只需使用映射的URL来调用它。感谢您的响应…我没有

Jquery rossDomain参数。你能告诉我它的基本情况或任何链接吗?在MVC方面,您的意思是这样的吗?您需要一个映射到某个URL的控制器方法,该URL将返回submitAndRefreshEmails方法。然后您只需使用映射的URL来调用它。感谢您的响应…我没有,jquery,ajax,json,spring-mvc,Jquery,Ajax,Json,Spring Mvc,rossDomain参数。你能告诉我它的基本情况或任何链接吗?在MVC方面,您的意思是这样的吗?您需要一个映射到某个URL的控制器方法,该URL将返回submitAndRefreshEmails方法。然后您只需使用映射的URL来调用它。感谢您的响应…我没有使用preventDefault来解决我的问题,但是是的,我已经将不同的值映射到返回Json响应的方法,并且该方法在不同的控制器中定义。 <form:form method="POST" commandName="emailDomain"


rossDomain参数。你能告诉我它的基本情况或任何链接吗?在MVC方面,您的意思是这样的吗?您需要一个映射到某个URL的控制器方法,该URL将返回submitAndRefreshEmails方法。然后您只需使用映射的URL来调用它。感谢您的响应…我没有使用preventDefault来解决我的问题,但是是的,我已经将不同的值映射到返回Json响应的方法,并且该方法在不同的控制器中定义。
<form:form method="POST" commandName="emailDomain">
    <form:textarea path="emailText" rows="5" id="emailList"
        placeholder="Write emails to submit us, saperated by ';'"
        style="width: 100%" />

<form:select items="${categoryMap}" path="categoryId" id="categoryList"
    onchange="showEmails()" />

    <br />
    <p align="center">
        <button type="button" value="Submit" id="submitEmails">Submit emails</button>
    </p>
    <p align="center" class="text-info">${var}</p>
</form:form>
<script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>

     <script type="text/javascript">
     function showEmails() {

            var categoryId = $('#categoryList').val();
    var emailText = $('#emailList').val();

    $.ajax({
        type : "POST",
        url : "http://localhost:8081/chatbooster/forms/email.html?cat=1",
                data : "categoryId=" + categoryId + "&emailText=" + emailText,
        success : function(response) {


        },
        error:function (xhRequest, ErrorText, thrownError) {
            alert('Error: '  + '  ' + thrownError);
        }
    });
}
@Controller
  @RequestMapping(value = "/email.html")
  public class EmailController{

    @RequestMapping(method = RequestMethod.GET)
      public String showForm(Model model,
          @RequestParam(value = "cat", required = true) String category,
          HttpServletRequest request, HttpServletResponse response) {
        clearSession(request, response);

        return "email";
      }

    @RequestMapping(value = "/submitemails", method = RequestMethod.GET)
      public @ResponseBody
      String submitAndRefreshEmails() {
        System.out.println("check");

        return "email";
      }

    @RequestMapping(method = RequestMethod.POST)
      public @ResponseBody
      EmailJsonResponse addEmail(@Valid EmailDomain emailDomain,
          BindingResult result,
          @RequestParam(value = "cat", required = true) String category,
          HttpServletRequest request, HttpServletResponse response)
      throws Exception {

        //return emailjsonresponse object, a simple object carrying few ints and strings

      }

    @ModelAttribute("categoryMap")
      public Map<Long, String> populateCategoryList(
          @RequestParam(value = "cat", required = true) String category)
      throws Exception {

        // populating drop down 

      }

  }
<script type="text/javascript">
  $(document).ready(function() {
      $('#submitEmails').onclick(function() {
          $.getJSON('http://localhost:8081/chatbooster/forms/submitemails.html?cat=1',
                {
                    categoryId : $('#categoryList').val(),
                    emailText : $('#emailList').val(),
                    ajax : 'true'
                }, 
                function(data) {
                    alert('data found');
                }
          );
      });
  });
$form.bind('submit', function(e) {
    $.post('epdReviewSaveChanges.json', mData, function(response) {
            //do stuff...
    }

    e.preventDefault();
    return false;
});
@RequestMapping(value="/Upload.html",method = RequestMethod.POST)