views:

107

answers:

5

I have problem with my ASP.NET MVC app when use Mozilla Firefox. I'm use JQuery and this code is not functional. In Google Chrome and IE 8 everything is fine. How solve this. If necessary I will post parts of my JQuerycode

In Site master page I include scripts, something like this:

 <script type="text/javascript" src="../../Scripts/jquery-1.3.2.js"></script>
 <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
 <script type="text/javascript" src="../../Scripts/ui.core.js"></script> 
 <script type="text/javascript" src="../../Scripts/ui.selectable.js"></script> 
 <script type="text/javascript" src="../../Scripts/ui/ui.accordion.js"></script>

<script type="text/javascript" src="../../Scripts/MicrosoftAjax.debug.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftMvcAjax.debug.js"></script>


 <script type="text/javascript" src="../../Scripts/jquery.dataTables.js"></script>
 <script type="text/javascript" src="../../Scripts/ui/ui.datepicker.js"></script> 
 <script type="text/javascript" src="../../Scripts/jquery.bstablecrosshair.js"></script>



<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqModal.js" type="text/javascript"></script>
<script src="../../Scripts/jqDnR.js" type="text/javascript"></script>

Most important part of code who is not work on Firefox:

     <script type="text/javascript">
     $(document).ready(function() {

    $('input:radio').click(function() {

        var num = "";
        var location = "";
        var loc = $("input:checked").val();
        var lenght = loc.lenght;
        var tmp = loc.substring(0, 2);

        if (tmp == "SA") {
            num = loc.substring(2, lenght);
            location = "SA";
        }
        if (tmp == "ST") {
            num = loc.substring(2, lenght);
            location = "STH";
        }
        if (tmp == "SH") {
            num = loc.substring(2, lenght);
            location = "SASTH";
        }
        if (tmp == "NE") {
            num = loc.substring(2, lenght);
            location = "NEW";
        }

        var article_number = $("input[id=" + num + "]").val();

        //alert(article_number +"  "+ num);

        $.post("/ImportXML/DevAccEditTempTable", { location: location, article_number: article_number, loc: num }, function(data) {
            if (data.error == "Error") {
                alert("Error: quantity is too large! ");
                window.location.href = "/" + data.redirect;

            }

            else {
                window.location.href = "/" + data.redirect;
            }
        }, "json");
    });
});
</script>
+1  A: 

Check whether Javascript is disabled in Firefox. Also, check for FF plugins such as adblockers that may be blocking some Google URLs, which could be a problem if you are letting Google host the JQuery library.

RedFilter
JavaScript is Enabled
Ognjen
A: 

Jquery has worked just fine for me on firefox, perhaps if you post the bit that is giving you a hard time the community here can point you in the right direction.

JoseMarmolejos
A: 

Install fiddler, browser act differently, some a strict and some are loose, you should understand that Chrome fixes problems in your code without you knowing, and firfox might not.

check Chrome Debugger Ctrl-Shift-J and install fiddler.

RobertPitt
I have this errors: $("#selectable").selectable is not a function and$("#datepicker").datepicker is not a function
Ognjen
Use Firebug instead ... the Console tab is a replacement of Fiddler.
Martin
make sure your you including the datepicker library in your head, datapickcer `jquery.ui.datepicker.js` - look at source here http://jqueryui.com/demos/datepicker/default.html
RobertPitt
+2  A: 

For basic Javascript/jQuery debugging, try this:

<script type="text/javascript">
        alert("Javascript works!");

        $(document).ready(function(){
            alert("jQuery works!");
        });
</script>

If you only get the first alert window, it means that something is wrong with the way that jQuery is referenced. If you don't get either window in Firefox (but you do in other browsers), you'll want to make sure that Javascript is turned on in Options > Content, and you'll want to make sure that no plugins would be blocking Javascript.

(Edited, because more code snippets have been added to the original post:)

In the second code snippet that you posted, "loc.lenght" should be "loc.length".

$('input:radio').click(function() {

    var num = "";
    var location = "";
    var loc = $("input:checked").val();
    var lenght = loc.lenght;
    var tmp = loc.substring(0, 2);
    alert(loc.substring(2, lenght));

It seems like the line var lenght = loc.lenght; is causing problems because loc.lenght probably isn't returning the value that you want (because lenght isn't a property). I've added an alert to your code, which should pop up the string that you calculate in the if statements following this section. You should run this code, with the alert in all three browsers to see what the difference is.

I'm not sure why this would be working in some browsers but not Firefox. Maybe loc.lenght is returning 0 in IE 8 and Chrome, but null in Firefox, which would break the whole calculation.

mlms13
Some part of my jQuery code work fine but some part do not
Ognjen
Thanks for adding more code -- that will definitely help. Where in your <head> is the jquery library referenced? Are you linking to it before you reference each of the jquery plugins? Also, are you referencing a local copy of jquery, or are you linking to an external copy hosted on the Google/Microsoft/jQeury CDN?
mlms13
Nevermind that last comment, I see you've updated the original post again.A couple things that stand out:You're referencing the same jquery library twice. It probably isn't causing the problem, but it's unnecessary. Also, this line has a typo:var lenght = loc.lenght;"lenght" should be "length". (If this part is critical, then I'm surprised it works in other browsers...)
mlms13
var lenght = loc.lenght; is work on IE 8 and Chrome
Ognjen
That's strange, because "lenght" isn't a real property. Even if this isn't the cause of the Firefox problem, you'll probably want to change that to "loc.length" if you want it to return a meaningful value.
mlms13
I'm not the best understood, could you at my code to show how to look
Ognjen
I'm not sure I understood your last comment, but I'll edit my answer so that I can show you in your code what I'm talking about.
mlms13
you solve my problem. I replaced "loc.lenght" with "loc.length" and now it works, tnx
Ognjen
A: 

If the posted scripts are the ones you're working with, it looks like you haven't actually included jQuery.

Ryan Kinal
Yes I include jQuery but it not displayed, check my code
Ognjen
Are you sure the plugins are compatible with jQuery 1.3.2?
Ryan Kinal
I used it on chrome, so I think it is
Ognjen
Ah, right. I overlooked that.
Ryan Kinal