Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:00:53+00:00 2026-06-15T10:00:53+00:00

I have a jquery on button click it runs a function in backend code.

  • 0

I have a jquery on button click it runs a function in backend code. my code will return a string which may contain some values. Can I say if my string contains then means success otherwise show error(see my code below), the following code throws a syntax error:

$.ajax({
                    type: "POST",
                    url: "MyPage.aspx/MyFunction",
                    data: "{'totalToPay': '" + totalToPay + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",

                    success: function (msg) {
                        if (msg.d.contains('https://')) { // THIS IS WHERE IT THROWS ERROR. AM DOING THIS AS MY STRING MAY CONTAIN http://www.test.com
                            alert("TEST");
                        }
                        else {
                            $("#error").show();
                            msgbox.html(msg.d);

                        }
                    }

                });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:00:54+00:00Added an answer on June 15, 2026 at 10:00 am
    msg.d.contains('https://')
    

    You want:

    msg.d.indexOf('https://') > -1
    

    You’re confusing contains with the jQuery DOM method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have jquery code that runs everytime everytime I click on my button but
I have some PHP code which runs a loop, spitting out a button and
I have the following jQuery code: $('.button').click(function(e) { e.preventDefault(); var id = $(this).attr('id'); var
I have this code jQuery('.button').click(function() { jQuery('.div1').animate({width: 'toggle'}); jQuery('.div2').animate({width: '100%'}); }); Works fine for
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody
Greetings all, I have a simple JQuery function which is bound to an ASP:Button
I have a jQuery.ajax() POST request, that runs on button click and has its
I have this jquery button click function: $(#NextButton_ButtonCtrl).live(click, function (event) { var i =
I have the following jQuery/ajax script: jQuery(input.button).click(function(){ jQuery.ajax({ url: 'addfav.php', type: 'POST', data: {'id':jQuery(this).closest(div).attr(id),is_ajax:
I currently have a jQuery code for 4 buttons. Basically you click the button,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.