Blog Posts List

0x800a139e – Syntax error, unrecognized expression (FIX)

by Yugolancer

Posted on August 13, 2016



Usually you get this error when you run an ASP.NET (Visual Studio 2kxx) Project having focus on a file that cannot be ran.

For instance if you edit your web.config and then just hit F5 key. JQuery will try to parse the url and as you guess it’s going to thrown an exception:


// e.g. 
contentTop.push($($(this).attr('href')).offset().top);

Fix: just open another file (view or page in design or code view) and re-run the project. Voila!

Read More


ASP.NET MVC AJAX request returns an Internal Server Error (FIX)

by Yugolancer

Posted on June 25, 2016



Usually you get this error if you have the data misspelled e.g. say that your ActionResult expects a param named userid while you are sending user (without id)


[HttpPost]
public ActionResult AddComment(string productid, string userid, string comment){
  // add the new comment and return Json response
}


$(".btn-comment").click(function(){
 
            var data = {};
            data.productid = @ViewBag.ProductID;
            data.user = @ViewBag.UserID;
            data.comment = $('#CommentText').val();
 
            $.ajax({
                url: '/Product/AddComment',
                type: "POST",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: JSON.stringify(data),
                success: function (result) {
                    alert("The new comment '" + result.comment + "' has been added successfully!");
                },
                error: function (status, ex) {
                    alert("Error Code: Status: " + status.statusText + " Ex: " + ex);
                }
            }); 
        });

meaning it is expecting data.userid and you send data.user :(

As you guess just change the data.user to data.userid and it will work as expected.

HTH

Read More


jQuery - Javascript Show and Hide Bootstrap Modal

by

Posted on November 29, 2017



jQuery

// show
$('#MyModal').modal("show");

// hide
$('#MyModal').modal("hide");

Javascript

// show
var modal = document.getElementById("MyModal");
modal.classList.add("in");
modal.style.display = "block";
document.body.classList.add("modal-open");

// hide
var modal = document.getElementById("MyModal");
 modal.classList.remove("in");
 modal.style.display = "none";
 document.body.classList.remove("modal-open");

Read More


Page 1 of 1

Copyright © ASPNETer 2006 - 2016