2

i use $.parseJSON to get data from a link.

My output link have

{"status":"ok", "message":'<form><input type="text" name="" value=""> </form>'}

And i want to append the "message" to my content.

$.ajax({
                    type : "POST",
                    url : "mylinl.php",
                    data : reservationForm.serialize(),
                    success : function(result) {

                        var data = $.parseJSON(result);

                        var result = data.status;
                        var message = data.message;

                        if (result == 'ok') {

                          $('#mycontent').html(message);

                        } else {

                          alert('Error Message: ' + message);
                        }
                    },

So i want to get the message : <form><input type="text" name="" value=""> </form> from my link and ouput to my #mycontent. is that possible?

Sorry for my bad english

4
  • 3
    you have to have double quotes and not single quotes around the <form>...</form> part Commented Jan 15, 2014 at 14:31
  • @MichaelKunst yes, but i want to use also double quotes inside my <input name="somename"> tag Commented Jan 15, 2014 at 14:34
  • @Mando Madalin are you tried this? then what's the result??? Commented Jan 15, 2014 at 14:34
  • escape them: {"status":"ok", "message":"<form><input type=\"text\" name=\"\" value=\"\"> </form>"} Commented Jan 15, 2014 at 14:34

1 Answer 1

5

inside your code, escape the doubble qoutes like this:

{"status":"ok", "message":"<form><input type=\"text\" name=\"\" value=\"\"> </form>"}
Sign up to request clarification or add additional context in comments.

1 Comment

form is still not in double quotes, change that ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.