input: Write a Python function to send a GET request to a specified URL, check the status code, and return the JSON data if the status code is 200. Use the `requests` library.
  ```python
  import requests
  
  def fetch_data(url):
      r = requests.get(url)
      if r.status_code == 200:
          return r.json()
      else:
          return None
  
  # Test cases
  assert fetch_data("https://example.com/data") is not None
  assert fetch_data("https://invalid-url.com") is None
output: import requests
  
  def fetch_data(url):
      r = requests.get(url)
      if r.status_code == 200:
          return r.json()
      else:
          return None