Need help selecting an element from a jquery response
Hey Guys,
I am trying to get the value of a hidden input element from a jquery ajax response. The default value for the hidden element is 0. But after the jquery post has been completed the hidden input value attribute gets changed to a different number(by php)
For some reason when I select the element from the data var (the response variable) and pass it into the html() function, it shows the value as 0 for the hidden input
Below is my code... any help would be really appreciated!
- $.post(url,obj_param)
- .done(function (data) {
- console.log(data);
- var thread_id = $("#thread").html(data);
- console.log(thread_id);
- });
- }
Here is a snippet of my html code
- <section class="message_form">
- <form action="http://localhost/GuruCoders/index.php/messages/NewMessageThread/index" class='msg_form' id='59' method="post" accept-charset="utf-8">
- <div id="err_msg"> Please enter a message to send </div>
- <textarea name="msg" class="msg" id="59" cols="30" rows="10"></textarea>
- <br>
- <input type="submit" name="send" value="Send">
- </form>
- <!-- The value returns as 0 not 55 -->
- <input type="hidden" id="thread" value="55" name="thread"/>
- </section>