php - Submit a form inside colorbox with ajax -


I used this code to post data from within the Color Boxes window until I entered encoding errors Instead of "ΔΙΧΡΩΜΟ" "ΞΞΞ§Ξ'Ξ © ΞΞ":

  $ ("# productadd") was doing. Submit (function () ($ (.post ($ (this) .attr ('Action'), $ (this). Serialize (), Function (Data) {Warning ('Added to Product Cart!'); $ (). Colorbox.close ();});  

After some searching, I decided to change my code, so I can set the encoding while posting, but it Some help is needed to complete:

  $. Ajax ({type: post}, url: $ (this) .attr ('action'), contentType: "application / json; Charset = iso-8859-7 ", data type:" json ", data:" {id: '' + someId + "'}", success: ph Quote (Jason) {Warning ('Product Added to Cart!'), $ (). Colorbox.close (), $ ("#Success") .HTML ("json.length =" + Json.length); Items AdClack (JSN);}, Error: (xhr, textStatus, errorThrown) {$ ("# Error") on the function. Html (xhr.responseText);}});  

No calls have been made within the success, the URL on the page is being redirected to the form action and not alert or $ (). While calling Colorbox.close (), with the previous code, It should be presented in the same window Ta (was not redirecting the action URL) and was showing a warning and in the end, the color box was closing the window. any suggestion?

You generally have to stop it from executing the default action, otherwise it will redirect the form URL A general form will redirect as submission.

  $ ("# productadd"). Submit (function (e) {e.preventDefault (); $ alex ({type: "post", url: $ (this) .attr ('action'), content type: "app / jason; charset = iso - 8859-7 ", Datatype:" Jason ", Data:" {ID: "Some ID +" '} ", Success: Function (JSN) {Warning (' Product Added to Cart '!), $ () ("Json.length =" + json.length); Item Edlockback (JSN);}, Error: Function (Excerpt, Textstats, ErrPrune) {$ (" # Error "). Html (xhr.responseText);}})}});  

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -