最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - $(...).serializeJSON is not a function - Stack Overflow

programmeradmin0浏览0评论

I have no idea why I am getting this error despite include a Jquery library. My code:

 function create() {
        var employeeForm = $("#createUser").serializeJSON();

      var employee = JSON.stringify(employeeForm);

      $.ajax({
        url: uric,
        type: 'POST',
        data: employee,
        success: function(results) {

        }
    });

The library:

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


<script type="text/javascript" src=".11.3/jquery.min.js"></script>

What could I be missing???

I have no idea why I am getting this error despite include a Jquery library. My code:

 function create() {
        var employeeForm = $("#createUser").serializeJSON();

      var employee = JSON.stringify(employeeForm);

      $.ajax({
        url: uric,
        type: 'POST',
        data: employee,
        success: function(results) {

        }
    });

The library:

<script type="text/javascript" src="http://ajax.aspnetcdn./ajax/jQuery/jquery-2.0.3.min.js"></script>


<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jquery/1.11.3/jquery.min.js"></script>

What could I be missing???

Share Improve this question asked Oct 15, 2015 at 4:09 refreshrefresh 1,3292 gold badges26 silver badges74 bronze badges 3
  • 5 1. You've included jQuery twice. 2. Use serialize or serializeArray. 3. To use serializeJSON you need to include github./marioizquierdo/jquery.serializeJSON library after jQuery – Tushar Commented Oct 15, 2015 at 4:10
  • 1 You're importing jQuery twice - why? And where did you get the idea that .serializeJSON() was part of jQuery? – Pointy Commented Oct 15, 2015 at 4:10
  • 2 Ok. So I need to include github./marioizquierdo/jquery.serializeJSON, right? I am so confused. – refresh Commented Oct 15, 2015 at 4:21
Add a ment  | 

1 Answer 1

Reset to default 2

Create a new JS script in your project and paste the script from there : https://raw.githubusercontent./marioizquierdo/jquery.serializeJSON/master/jquery.serializejson.js. Then add then script src to your page.

发布评论

评论列表(0)

  1. 暂无评论