Crazy_Robert Posted November 28, 2017 Report Share Posted November 28, 2017 This is the error I am getting : Uncaught Error: Syntax error, unrecognized expression: #tmpltffField1 at Function.Sizzle.error (jquery-1.12.4.js:1503) at Sizzle.tokenize (jquery-1.12.4.js:2160) at Sizzle.select (jquery-1.12.4.js:2581) at Function.Sizzle [as find] (jquery-1.12.4.js:904) at jQuery.fn.init.find (jquery-1.12.4.js:2827) at new jQuery.fn.init (jquery-1.12.4.js:2950) at jQuery (jquery-1.12.4.js:75) at OptFldTextChangeEvent (eval at <anonymous> (jquery-1.12.4.js:349), <anonymous>:65:13) at HTMLInputElement.eval (eval at <anonymous> (jquery-1.12.4.js:349), <anonymous>:46:17) at HTMLInputElement.dispatch (jquery-1.12.4.js:5227) this is my jQuery Code var fldName = field.attr('name'); fldName = fldName.replace("fd", "tmpltff"); fldName = fldName.replace("bd", "tmpltbf"); $('#'+fldName).html(field.val()); } This code is commented out because it takes longer time for post back $('#Template').css('display', 'block'); var formdata = $("#Order").serialize(); $.ajax({ type: 'post', url: '@Url.Action("GetRelevantTemplate", "CardTemplates")', data: formdata, dataType: "html", success: function (data) { $('#Template').html(data); $('#Template').css('display', 'block'); }, failure: function (data) { alert(data.responseText); }, error: function (data) { alert(data.responseText); } }); return false; Quote Link to comment Share on other sites More sharing options...
Crazy_Robert Posted November 28, 2017 Author Report Share Posted November 28, 2017 Uncaught Error: Syntax error, unrecognized expression: '#o1w609accordion' at Function.fa.error (jquery.js?ver=1.12.4:2) at fa.tokenize (jquery.js?ver=1.12.4:2) at fa.select (jquery.js?ver=1.12.4:2) at Function.fa (jquery.js?ver=1.12.4:2) at Function.a.find (jquery-migrate.min.js?ver=1.4.1:2) at n.fn.init.find (jquery.js?ver=1.12.4:2) at n.fn.init.a.fn.find (jquery-migrate.min.js?ver=1.4.1:2) at a.fn.init.n.fn.init (jquery.js?ver=1.12.4:2) at a.fn.init (jquery-migrate.min.js?ver=1.4.1:2) at n (jquery.js?ver=1.12.4:2) voteaccepted You have too many ' in your selector. The jquery error for an unrecognized expression is (for $("{")): Uncaught Error: Syntax error, unrecognized expression: { while your error is: Uncaught Error: Syntax error, unrecognized expression: '#o1w609accordion' so your, translated, expression is: $("'#o1w609accordion'") Remove the extra ' and you should be ok, possibly: $(`${hash}`) Quote Link to comment Share on other sites More sharing options...
Crazy_Robert Posted November 28, 2017 Author Report Share Posted November 28, 2017 Tried this also ... not working.. postback ki chala time theeskuntudhi ani change chesanu code.. any better way to do ? Quote Link to comment Share on other sites More sharing options...
jalamkamandalam Posted November 28, 2017 Report Share Posted November 28, 2017 Bro, I suspect something wrong with that replace() function you are using. Try 'replaceWith' on jQuery elements instead of replace(). Surely there is something there only. I have tried your Post Call code locally and there is nothing wrong in it. Please tweak something around that replace() function. Quote Link to comment Share on other sites More sharing options...
jalamkamandalam Posted November 28, 2017 Report Share Posted November 28, 2017 Also if you are using IE9 and above, please stop using single quote ' for wrapping an element identifier. It created hell for me in one of the projects that I worked. Use double quotes and use + if you want to join more than one string. Quote Link to comment Share on other sites More sharing options...
Crazy_Robert Posted November 28, 2017 Author Report Share Posted November 28, 2017 Just now, jalamkamandalam said: Bro, I suspect something wrong with that replace() function you are using. Try 'replaceWith' on jQuery elements instead of replace(). Surely there is something there only. I have tried your Post Call code locally and there is nothing wrong in it. Please tweak something around that replace() function. Thank You Bro.. post call code is working. but its taking longer time to display Quote Link to comment Share on other sites More sharing options...
Crazy_Robert Posted November 28, 2017 Author Report Share Posted November 28, 2017 2 minutes ago, jalamkamandalam said: Also if you are using IE9 and above, please stop using single quote ' for wrapping an element identifier. It created hell for me in one of the projects that I worked. Use double quotes and use + if you want to join more than one string. IE really sucks. Quote Link to comment Share on other sites More sharing options...
jalamkamandalam Posted November 28, 2017 Report Share Posted November 28, 2017 2 minutes ago, Crazy_Robert said: Thank You Bro.. post call code is working. but its taking longer time to display Ok. Please try to clear the browser cache and then try. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.