Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get variable out of .ajax callback?
    primarykey
    data
    text
    <p>I am using the editInPlace jquery plugin for editing:</p> <pre><code>$(".edit-synonyms").editInPlace(varSettings); </code></pre> <p>The settings for it are:</p> <pre><code>varSettings= { show_buttons: true, error_sink: null, context: "#error", callback: function(idOfEditor, enteredText, originalHTMLContent, settingsParams, callbacks) { varID=$(this).attr('id'); var data ='update_value=' + encodeURIComponent(enteredText) + '&amp;element_id=' + $(this).attr("id") + '&amp;original_value=' + encodeURIComponent(originalHTMLContent); $.ajax({ url: "/inc/ajax-synonim.asp?action=edit", type: "POST", data: data, dataType: "html", complete: function(request){ }, success: function(html, textStatus){ if (html != "False") { $.get('/inc/ajax-synonim.asp?action=sinonimke&amp;ID=' + IDSinonimka, function(data){ varBesede=data.split("|"); $('.sinonimke-'+IDSinonimka).text(varBesede[1]); $('.beseda-'+IDSinonimka).text(varBesede[0]); }) } else { alert("Word exists in database!") } } }) alert(error); var new_text = enteredText || originalHTMLContent; return new_text; } } </code></pre> <p>My problem is that I get what is returned from server side on .ajax success as html variable. But this variable is not seen in the Settings (outside of the .ajax call). If it is not visible, I can not deternine if the postback was false or a good value and I can not respond properly.</p> <ol> <li>Is there a way to see the html variable in the callback outside of .ajax function?</li> <li>If not, is there a way I could return the html value from the .ajax function to the callback of the inline editor?</li> <li>If not, is the ponly way to do another ajax call in callback to check for word if it exists?</li> </ol>
    singulars
    1. This table or related slice is empty.
    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. 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