In general, there is a website with a bunch of things that use jquery.min.js(jQuery JavaScript Library v1.4.4)

And there is an ajax request that works on jQuery 1.8.0, but does not work on 1.4.4 (why, I don't know, I don’t rummage in this). Help it under 1.4.4 remake.

Here is the script:

 function selectModel(Obj) { var auto = Obj.value; $.ajax({ type: "POST", url: "/ajax/ajaxbase/modelcheckbox", data: { auto: auto }, /*dataType: "json",*/ cache: false, success: function (responce) { $('div[name="model_panel"]').html(responce); } }); }; 

UPD Found a typo in the ajax / ajaxbase / modelcheckbox file Fixed, but now the error is as follows

 Uncaught SyntaxError: Unexpected end of input http://127.0.0.6/:1 Uncaught ReferenceError: selectModel is not defined http://127.0.0.6/:468 

Line 1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Line 468: <li><input type='checkbox' name='auto[]' id='auto1' value='Acura' onclick='javascript:selectModel(this);'/><label for='auto1' >Acura</label></li>

UPD2 Problem solved, upd1 arose due to a randomly erased closing brace

    1 answer 1

     500 (Internal Server Error) 

    Well so here and ajax request and jQuery? if the error is on server 500!

     var auto = Obj.value; // переменная auto $.ajax({ type: "POST", url: "/ajax/ajaxbase/modelcheckbox", data: { auto: auto // и тут тоже самое }, 

    try change to

     var auto = Obj.value; // переменная auto $.ajax({ type: "POST", url: "/ajax/ajaxbase/modelcheckbox", data: { a: auto }, 

    Maybe he does not like it, and in general to transfer the name of a variable with the same name as a variable is somehow silly. then they are variables to distinguish what is transmitted from how to get the value

    • 2
      I also thought so at first, but the TS claims that there are no such problems with 1.8> transfer the name of a variable with the same name as a variable, a kind of stupidly strange statement - Specter
    • no, in terms of whether there is a conflict that the auto variable is being passed, but above they are declared as var auto = Obj.value; No, maybe Friday is affecting me and what's coming home soon, it's time to start working this week :) Well, the script may not work if the error is on the server! - Artem
    • 2
      No, there can be no conflict: var auto = 'text'; var obj = {auto: auto}; obj // {auto: "text"} - Specter
    • so I was right! - Artem