Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Updated</strong></p> <p>Your button for the form could make use of the <code>onClick</code> attribute, which would invoke a method to parse the form fields and post the data to your php script via <code>.ajax()</code>. </p> <p>In the <code>success</code> event method you then check any flags you need to and modify the element as you desire if needed.</p> <p>Basic example:</p> <p>Inside of <code>.ajax()</code>:</p> <pre><code>... url: 'xxx.xxx.xxx', async: true, type: 'POST', dataType: 'html', data: JSON.stringify( form_fields ), beforeSend: function() { // Pre send stuff, like starting a loading gif }, success: function( data, textStatus, xhr ) { // Be sure you load the page with the content first $( '#containing-div' ).html( data ); // Do your check here, and modify your element if needed here if( flagtocheck === 'xxx' ) { // Modify the element in question... } // I call a custom method termed `.ctrls()` here that makes any // adjustments to the DOM once its loaded/updated. }, error: function( xhr, textStatus, errorThrown ) { } </code></pre> <p>Of course, you'll want to set <code>flagtocheck</code> appropriately in your case.</p> <p>Hope that helps!</p> <p><strong>Note regarding edit</strong> <em>This post was edited to be a little more descriptive and more easily understood. Since the person asking the question is already using the <code>.ajax()</code> method, the <code>success</code> event method is the ideal place for doing what the person asking the question is requesting. It is 1 less method invocation to directly modify the element there than using it to call <code>.trigger()</code> or <code>.change()</code> which then also directly modifies the element.</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload