Expected jQuery and AJAX behavior?
I am new to jQuery and am not sure if the behavior I am observing is expected or if I am just missing something. I am using jQuery to make an AJAX call to update a <div id="test"> like this:
- $('#submit').click(function() {
-
- var form_data = {
- ticker: $('#ticker').val(),
- type: 'summary'
- };
- $.ajax( {
- url:"<?php echo site_url('analysis/getDetail'); ?>",
- type: 'POST',
- data: form_data,
- success: function(msg) {
- $('#test').html(msg);
- }
- });
-
- return false;
-
- });
My getDetail function simply returns the following string:
- <a href="index.html">Click Me</a>
which shows up as expected in the <div id="test">. However, this new href is not active, meaning that I can't drill into the "Click Me" to get to the index.html page. Additionally, I've also returned plain text to the <div> and can't highlight, select, copy this new text as I would expect. Is this normal behavior or, as I fully expect, just user error on my part?
Thanks for any suggestions.