title: call struts action from jquery - need help on how to make struts call and define struts action
body: <p>I am fairly new to struts so I need to apologize for my lack of understanding. I am trying to execute a struts action that does an update on my database using jquery and need some guidance on how to do it. I have had a crack at it but it's not right.</p>
  
  <p>I have a jquery dialog in my jsp(see below). You can see that on click of the button in this dialog I call a function named myAjaxCall()...</p>
  
  <pre><code>&lt;s:div id="dialog-form" title="Update" style="display:none"&gt;
  &lt;s:form id="dform" enctype="multipart/form-data" &gt;
      &lt;s:textfield  name="strid" id="strid" label="Store" readonly="true"  /&gt;
      &lt;s:textfield  name="strName" id="strName" label="Store Name" readonly="true" /&gt;
      &lt;s:textfield  name="businessDt" id="businessDt" label="Business Date" readonly="true"  /&gt;
      &lt;s:textfield  name="openingtime" id="openingtime"  label="Opening time(EST)" /&gt;
      &lt;s:textfield  name="closingtime" id="closingtime"  label="Closing time(EST)" /&gt;
      &lt;s:textfield  name="reason" id="reason" label="Reason" /&gt;
      &lt;s:url id="ajaxDialog" value="/storeCurrentStatusDialog.action"/&gt;
      &lt;table style="border:0"  &gt;
       &lt;tr&gt;
        &lt;td align="center"&gt;&lt;input type="button" value="Update" onclick="myAjaxCall()"  &gt;&lt;br/&gt;&lt;/td&gt;
       &lt;/tr&gt;
      &lt;/table&gt;
   &lt;/s:form&gt;
  &lt;/s:div&gt;
  </code></pre>
  
  <p>Then i have a jquery function named myAjaxCall() that looks like this. I am telling it to run an ajax function using json.</p>
  
  <pre><code>function myAjaxCall() {
      var url="${pageContext.request.contextPath}/storeCurrentStatusDialog.action?strid="+document.dform.strid.value+"&amp;closingtime="+document.dform.closingtime.value+"&amp;openingtime="+document.dform.openingtime.value+"&amp;businessDt="+document.dform.businessDt.value+"&amp;reason="+document.dform.reason.value;
  
  $.ajax({
      type: 'GET',
      url: url,
      dataType: 'json',
      success: function(data){
          console.log(stringify(data));
      }});
  </code></pre>
  
  <p>}</p>
  
  <p>The URL variable is being populated properly but my struts action is not being called. My first question is the dataType I am sending is json. WIll this automatically work. And the second question I have is how do I define my struts action in the struts.xml file for this to work. Something like this? The will return success.</p>
  
  <pre><code>    &lt;action name="storeCurrentStatusDialog"
          class="com.mycompany.eposweb.action.StoreCurrentStatusAction"
          method="update"&gt;
          &lt;result name="success" type="stream"&gt;
              &lt;param name="contentType"&gt;text/html&lt;/param&gt;
              &lt;param name="inputName"&gt;inputStream&lt;/param&gt;
          &lt;/result&gt;
      &lt;/action&gt;
  </code></pre>
  
  <p>thanks</p>