0

I am using jquery to do some ajax calls. I'm working in Chrome and when I include my javascript file as show below:

<script src="js/collectInfo.js" type="text/javascript"></script>

the code shows up in my php file under the Element tab. It does not show as a separate file in my scripts. Essentially it's as if it's being embedded in my code. This is making it very difficult to debug.

Any idea why it would do this?

More info: This only happens when I add this function to the bottom of the js file

function sendRequest(type){

    var first_name=$('#mce_FNAME').val();
    var last_name=$('#mce_LNAME').val();
    var email=$('#mce_EMAIL').val();
    var phone=$('#mce_PHONE').val();
    var advocateID=$('#mce_SPID').val();

    $.ajax({
        data:{
            first_name:first_name,
            last_name:last_name,
            email:email,
            phone:phone,
            advocateID:advocateID,
            mode:type
        },
        url:'ajax_fp_info.php',
        type: "POST",
        dataType: "text",
        success:function(data){
            data=$.parseJSON(data);
            if(data.error != undefined){
                if(data.error !== false){
                    showError(data.error);
                }
                else{
                    $('#mc-embedded-subscribe-form').submit();                    
                }
            }
        },
        complete:function(){
            stopProcessing();

        }

    });


}

This is what my element tab ends up looking like in chrome:

<script src="js/default.js." type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
var validate=new Array();$(function(){});function textFocus(sup){if($(sup).is('.pale'))    {$(sup).removeClass('pale');$(sup).val('');$(sup).attr('onclick','');}
else{}}
function validateReque...

As you can see some of my js files show up correctly, that is they just show the script tags, but the rest jumbles up.

tomjung
  • 715
  • 3
  • 11
  • 34

1 Answers1

0

This is obvious, the ajax populates your page and manipulates your DOM and that is exactly what elements tab shows in Chrome. You get to see your DOM it is not like view source of page.

defau1t
  • 10,593
  • 2
  • 35
  • 47