Jump to content

jQuery sahayam


Crazy_Robert

Recommended Posts

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;

 

Link to comment
Share on other sites

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}`)
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...